<!--registration Module-->default.asp
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title>Ajax-Sample1</title>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>//Please make sure the encoding of this page is set to UTF-8, otherwise there will be garbled
<meta name= "Author" content= "tonyhl[at]126.com"/>
<meta http-equiv= "Pragma" content= "No-cache"/>
<script language= "javascript" type= "Text/javascript" src= "Reg.js" ></script>
<link rel= "stylesheet" href= "Css.css" type= "Text/css" media= "All"/>
<style type= "Text/css" >
<!--
#Layer1 {
Position:absolute;
width:200px;
height:115px;
Z-index:1;
left:409px;
top:88px;
}
-->
</style>
<body>
<div id= "Layer1" >
<div id= "MSG" ></div>
</div>
ID: <input type= "text" id= "Regid"/>
Password: <input type= "Password" id= "Regpassword"/>
<input name= "F" type= "file"/>
<input type= "Submit" id= "Regsubmit" value= "register" onclick= "Check ()"/>
To highlight no refresh effect, the server-side program will automatically perform the million addition operation
</body>
Copy Code code as follows:
<!----form data submission Script--->reg. Js
function GE (a) {return document.getElementById (a);}
function Check () {
if (GE (' Regid '). value== ') {ge (' msg '). innerhtml= ' id cannot be empty '; return false}
if (GE (' Regpassword '). value== ') {ge (' msg '). innerhtml= ' password cannot be empty '; return false}
var x=new activexobject ("msxml2.xmlhttp");
if (X) {
GE (' Regsubmit '). Disabled=true;
X.onreadystatechange=function () {
if (x.readystate==4) {
if (x.status==200) {
Eval (x.responsetext)
}
Else{ge (' msg '). Innerhtml=x.statustext}
}
Else{ge (' msg '). innerhtml= "Submitting data ..."}
};
X.open (' POST ', ' reg.asp ', true);
X.setrequestheader (' Content-type ', ' application/x-www-form-urlencoded ');
var senddata = ' regid= ' +ge (' regid ') value+ ' ®password= ' +ge (' Regpassword '). value+ ' &file= ' +GE (' f '). Value
X.send (SendData)
}
else{
GE (' msg '). innerhtml= ' Your browser does not support XMLHttpRequest '
}
}
<!---process--->reg.asp
Copy Code code as follows:
<%@ language= "VBSCRIPT" codepage= "65001"%>//codepage must be 650001, Otherwise, there will be garbled, if there is HTML text, it must be set to UTF-8 encoding, otherwise it would appear garbled.
<%
Dim regid, Regpassword, str
regid=request.form ("Regid")
Regpassword=request.form ("Regpassword"
F=request.form ("file")
Dim I, ii
II = 0
For i = 0 to 1000000
II = II + i
Next
If regid= "" or regpassword= "" then
str = "ID and password must be filled in"
Else
If regid <> "Tony" then
Str = ' registered successfully, ID ' & regid & ', password is ' & regpassword&f
Else
str = ' registration failed, ID already exists '
End If
En D If
Response.Write "GE (' msg '). Innerhtml= '" & Str & "; GE (' Regsubmit '). Disabled=false "
Response.End
%>