AJAX.JS
上传用户:szhf331
上传日期:2022-06-22
资源大小:1032k
文件大小:3k
- function checkcode(regcode){
- var xmlhttp;
- try{
- xmlhttp=new XMLHttpRequest();
- }
- catch(e){
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function(){
- if (xmlhttp.readyState==4){
- if (xmlhttp.status==200){
- var data=xmlhttp.responseText;
- code_result(data);
- }
- else{
- $("span")[13].innerHTML="验证码校验失败,请联系管理员";
- }
- }
- else{
- $("span")[13].innerHTML="正在进行验证码校验...";
- }
- }
- //alert("请详细填写家庭住址!");
- xmlhttp.open("post", "check_code.asp", true);
- xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
- xmlhttp.send("regcode="+escape(regcode));
- }
- function code_result(data){
- var resultbox=$("span")[13];
- if(data==1){
- resultbox.innerHTML='<img src="images/reg_yesok.gif"/> 验证码正确';
- flag[5]=1;
- check_data();
- }
- else{
- resultbox.innerHTML='<img src="images/reg_yesno.gif"/> 验证码错误';
- flag[5]=0;
- check_data();
- }
- }
-
- //--------------------------------------------------------------------
- function checkid(regid){
- var xmlhttp;
- try{
- xmlhttp=new XMLHttpRequest();
- }
- catch(e){
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function(){
- if (xmlhttp.readyState==4){
- if (xmlhttp.status==200){
- var data=xmlhttp.responseText;
- id_result(data);
- }
- else{
- $("span")[0].innerHTML="用户名检测失败,请联系管理员";
- }
- }
- else{
- $("span")[0].innerHTML="正在进行用户名校验...";
- }
- }
- xmlhttp.open("post", "reg_check.asp", true);
- xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
- xmlhttp.send("regid="+escape(regid));
- }
- function id_result(data){
- var resultbox=$("span")[0];
- if(data==1){
- resultbox.innerHTML='<img src="images/reg_yesok.gif"/> 用户名可用';
- flag[4]=1;
- check_data();
- }
- else{
- resultbox.innerHTML='<img src="images/reg_yesno.gif"/> 该用户名已经被注册';
- flag[4]=0;
- check_data();
- }
- }
- //--------------------------------------------------------------------
- function sendinfo(regname,pwd,email,problem,Answer,UserName,Age,IdentityNO,Phone,Telephone,address,Sex){
- var xmlhttp;
- try{
- xmlhttp=new XMLHttpRequest();
- }
- catch(e){
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function(){
- if (xmlhttp.readyState==4){
- if (xmlhttp.status==200){
- var data=xmlhttp.responseText;
- reg_result(data);
- }
- else{
- $("span")[14].innerHTML="注册失败,请联系管理员";
- }
- }
- else{
- $("span")[14].innerHTML="正在进行用户名注册...";
- }
- }
- xmlhttp.open("post", "reg.asp", true);
- xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
- xmlhttp.send("regname="+escape(regname)+"&pwd="+escape(pwd)+"&email="+escape(email)+"&problem="+escape(problem)+"&Answer="+escape(Answer)+"&UserName="+escape(UserName)+"&Age="+escape(Age)+"&IdentityNO="+escape(IdentityNO)+"&Phone="+escape(Phone)+"&Telephone="+escape(Telephone)+"&address="+escape(address)+"&Sex="+escape(Sex));
- }
- function reg_result(data){
- if(data==1){
- //$("span")[14].innerHTML='<a href="login.asp" target="_blank">'+$("input")[0].value+",注册成功!</a>";
- srcs.src=srcs.src+'?'+Math.random();
- top.location.href='Registration.asp?action=suc';
- }
- else{
- $("span")[14].innerHTML="注册失败,请联系管理员";
- }
- }