代码如下:
function Ajax_GetPageCode(s){
if(s!=s.match(/^[a-z0-9_\u4e00-\u9fa5]{5,20}$/)){alert('用户名不合法');$('UserName').focus();return;}
var rndStr='';
if(oldName==''){
oldName=s;
rndStr=Math.random()*100000;
}else{
if(oldName!=s){
oldName=s;
rndStr=Math.random()*100000;
}
}
Ajax_StartGet('Register.asp?CheckRegName='+s,rndStr);
}
function Ajax_StartGet(s,rndStr)
{
var spStr='?';
if(s.indexOf('?')!=-1){spStr='&';}
var XH=new XMLHttpObject(s+spStr+'Rnd='+rndStr,true,Ajax_ProcessResult);  ///这句
$('CheckButton').disabled=true;
try{
XH.sendData();
}catch(e)
{
alert('出现错误,只限获取本域名下的资源!不得跨域获取!\n\n若长时间停止响应,请刷新本页面,可能是因为ajax取未存在的文件引起的.');
Ajax_ProcessResult('');
}
}
function Ajax_ProcessResult(s)
{
eval(s);
}"///这句"看不懂是什么意思?有谁指教一下,并说一下,如果在单击按钮的时候,页面如何无刷新的显示当前用户名已经被注册?谢谢!附AjaxRequest代码:
function XMLHttpObject(url,Syne,method){
var XMLHttp=null;
var o=this;
this.url=url;
this.Syne=Syne;
this.sendData = function(){
if (window.XMLHttpRequest) {
XMLHttp = new XMLHttpRequest();}
else if (
window.ActiveXObject){
XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");}
with(XMLHttp){
open("GET", this.url, this.Syne);
onreadystatechange = o.CallBack;send(null);}
}
this.CallBack=function(){
if (XMLHttp.readyState == 4) {
if (XMLHttp.status == 200) {
method(XMLHttp.responseText);}
}
}
this.getText=function(){
if (XMLHttp==null) {
return "not ready.";}
if (XMLHttp.readyState==4) {
return XMLHttp.responseText;}
return XMLHttp.readyState;
}
}