?? guestedit.asp
字號(hào):
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Set ObjReference = Server.CreateObject("jxc1.check")
ObjReference.myfileb()
%>
<!--#include file="../../Connections/jxc.asp" -->
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables
If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then
MM_editConnection = MM_jxc_STRING
MM_editTable = "guest"
MM_editColumn = "id"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "guestlist.asp"
MM_fieldsStr = "gname|value|gaddress|value|gperson|value|gyoubian|value|gfax|value|gtel1|value|gtel2|value|gbank|value|gbankno|value|gmail|value|gweb|value|xinyong|value|xinyongover|value|gselect|value|other|value"
MM_columnsStr = "gname|',none,''|gaddress|',none,''|gperson|',none,''|gyoubian|',none,''|gfax|',none,''|gtel1|',none,''|gtel2|',none,''|gbank|',none,''|gbankno|',none,''|gmail|',none,''|gweb|',none,''|xinyong|none,none,NULL|xinyongover|none,none,NULL|gselect|',none,''|other|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Update Record: construct a sql update statement and execute it
If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("id") <> "") Then
Recordset1__MMColParam = Request.QueryString("id")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_jxc_STRING
Recordset1.Source = "SELECT * FROM guest WHERE id = " + Replace(Recordset1__MMColParam, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>www.71base.com</title>
<link href="CSS.CSS" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function YY_checkform() { //v4.65
//copyright (c)1998,2002 Yaromat.com
var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
for (var i=1; i<args.length;i=i+4){
if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
myV=myObj.value;
if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
if (myReq&&myObj.value.length==0){addErr=true}
if ((myV.length>0)&&(args[i+2]==1)){ //fromto
var myMa=args[i+1].split('_');if(isNaN(parseInt(myV))||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
} else if ((myV.length>0)&&(args[i+2]==2)){
var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
} else if ((myV.length>0)&&(args[i+2]==3)){ // date
var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
if(myAt){
var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
var myDate=new Date(myY,myM,myD);
if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
}else{addErr=true}
} else if ((myV.length>0)&&(args[i+2]==4)){ // time
var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
} else if (myV.length>0&&args[i+2]==5){ // check this 2
var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
if(!myObj1.checked){addErr=true}
} else if (myV.length>0&&args[i+2]==6){ // the same
var myObj1 = MM_findObj(args[i+1]);
if(myV!=myObj1.value){addErr=true}
}
} else
if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
if (args[i+2]==2){
var myDot=false;
for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
if(!myDot){myErr+='* ' +args[i+3]+'\n'}
}
} else if (myObj.type=='checkbox'){
if(args[i+2]==1&&myObj.checked==false){addErr=true}
if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
} else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
}else if (myObj.type=='textarea'){
if(myV.length<args[i+1]){addErr=true}
}
if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
}
if (myErr!=''){alert('注意:\t\t\t\t\t\n\n'+myErr)}
document.MM_returnValue = (myErr=='');
}
//-->
</script>
</head>
<body oncontextmenu="return false" >
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/icon-page.gif" width="16" height="15"><font color="#4289F4">客戶信息修改>></font></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form action="<%=MM_editAction%>" method="POST" name="form1" onSubmit="YY_checkform('form1','gname','#q','0','請(qǐng)?zhí)顚懣蛻裘Q','gaddress','#q','0','請(qǐng)?zhí)顚懣蛻舻刂?#039;,'gperson','#q','0','請(qǐng)?zhí)顚懧?lián)系人','gyoubian','#q','0','請(qǐng)?zhí)顚戉]政編碼','gtel1','#q','0','請(qǐng)?zhí)顚戨娫?','gmail','S','2','請(qǐng)正確填寫郵件地址','xinyong','#0_9999999999999','1','請(qǐng)正確填寫信用金額');return document.MM_returnValue">
<table width="518" border="0" align="center" cellspacing="0">
<tr valign="baseline">
<td nowrap align="right">客戶名稱:</td>
<td> <input type="text" name="gname" value="<%=(Recordset1.Fields.Item("gname").Value)%>" size="32">
<font color="#FF0000">*</font> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">客戶地址:</td>
<td> <input type="text" name="gaddress" value="<%=(Recordset1.Fields.Item("gaddress").Value)%>" size="32">
<font color="#FF0000">*</font> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">聯(lián) 系 人:</td>
<td> <input type="text" name="gperson" value="<%=(Recordset1.Fields.Item("gperson").Value)%>" size="32">
<font color="#FF0000">*</font> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">郵政編碼:</td>
<td> <input type="text" name="gyoubian" value="<%=(Recordset1.Fields.Item("gyoubian").Value)%>" size="32">
<font color="#FF0000">*</font> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">傳 真:</td>
<td> <input type="text" name="gfax" value="<%=(Recordset1.Fields.Item("gfax").Value)%>" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">電 話1:</td>
<td> <input type="text" name="gtel1" value="<%=(Recordset1.Fields.Item("gtel1").Value)%>" size="32">
<font color="#FF0000">*</font> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">電 話2:</td>
<td> <input type="text" name="gtel2" value="<%=(Recordset1.Fields.Item("gtel2").Value)%>" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">開戶銀行:</td>
<td> <input type="text" name="gbank" value="<%=(Recordset1.Fields.Item("gbank").Value)%>" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">銀行帳號(hào):</td>
<td> <input type="text" name="gbankno" value="<%=(Recordset1.Fields.Item("gbankno").Value)%>" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">電子郵件:</td>
<td> <input type="text" name="gmail" value="<%=(Recordset1.Fields.Item("gmail").Value)%>" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">公司網(wǎng)站:</td>
<td> <input type="text" name="gweb" value="<%=(Recordset1.Fields.Item("gweb").Value)%>" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">信用金額:</td>
<td><input type="text" name="xinyong" value="<%=(Recordset1.Fields.Item("xinyong").Value)%>" size="32">
元<font color="#FF0000">*</font> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">已用信用金額:</td>
<td> <%content = Server.HTMLEncode((Recordset1.Fields.Item("xinyongover").Value))
response.write content%>
元
<input type="hidden" name="xinyongover" value="<%=(Recordset1.Fields.Item("xinyongover").Value)%>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">關(guān) 系:</td>
<td> <select name="gselect">
<option value=<%=(Recordset1.Fields.Item("gselect").Value)%>><%=(Recordset1.Fields.Item("gselect").Value)%></option>
<option value="供貨關(guān)系">供貨關(guān)系</option>
<option value="購(gòu)貨關(guān)系">購(gòu)貨關(guān)系</option>
</select>
<font color="#FF0000">*</font> </td>
</tr>
<tr>
<td nowrap align="right" valign="top">備 注:</td>
<td valign="baseline"> <textarea name="other" cols="50" rows="3"><%=(Recordset1.Fields.Item("other").Value)%></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td> <input type="submit" value="更新客戶信息"> </td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("id").Value %>">
</form></td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -