AJAX返回undefined
<html><head><title>???</title><metahttp-equiv="content-typecontent="text/html;charset...
<html>
<head>
<title>???</title>
<meta http-equiv="content-type content="text/html; charset=utf-8"/>
<script>
function getXmlHttpObject(){
var request=false;
//window对象中有XMLHttpRequest存在就是非IE,包括(IE7,IE8)
if(window.XMLHttpRequest){
request=new XMLHttpRequest();
if(request.overrideMimeType){
request.overrideMimeType("text/xml");
}
//window对象中有ActiveXObject属性存在就是IE
}else if(window.ActiveXObject){
var versions=['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Msxml2.XMLHTTP.7.0','Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
for(var i=0; i<versions.length; i++){
try{
request=new ActiveXObject(versions[i]);
if(request){
return request;
}
}catch(e){
request=false;
}
}
}
return request;
}
var myXlmHttpRequest="";
function checkeName(){
var myXlmHttpRequest=getXmlHttpObject();
if(myXlmHttpRequest)
var url="/registerPro.php?username="+$("username").value;
myXlmHttpRequest.open("get",url,true);
myXlmHttpRequest.onreadystatechange=chuli;
myXlmHttpRequest.send(null);
}
}
function $(id){
return document.getElementById(id);
}
function chuli(){
window.alert("处理函数被调用" + myXlmHttpRequest.readyState);
}
</script>
</head>
<body>
<form action="??" method="post">
用户名字:<input type="text" name="username1" id="username">
<input type="button" onclick="checkeName();" value="验证用户名">
<input style="border-width: 0;color:red" type="text" id="myres">
<br/>
用户密码:<input type="password" name="password"><br/>
用户邮件:<input type="text" name="email"><br/>
<input type="submit" value="用户注册">
</form>
</body>
</html> 展开
<head>
<title>???</title>
<meta http-equiv="content-type content="text/html; charset=utf-8"/>
<script>
function getXmlHttpObject(){
var request=false;
//window对象中有XMLHttpRequest存在就是非IE,包括(IE7,IE8)
if(window.XMLHttpRequest){
request=new XMLHttpRequest();
if(request.overrideMimeType){
request.overrideMimeType("text/xml");
}
//window对象中有ActiveXObject属性存在就是IE
}else if(window.ActiveXObject){
var versions=['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Msxml2.XMLHTTP.7.0','Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
for(var i=0; i<versions.length; i++){
try{
request=new ActiveXObject(versions[i]);
if(request){
return request;
}
}catch(e){
request=false;
}
}
}
return request;
}
var myXlmHttpRequest="";
function checkeName(){
var myXlmHttpRequest=getXmlHttpObject();
if(myXlmHttpRequest)
var url="/registerPro.php?username="+$("username").value;
myXlmHttpRequest.open("get",url,true);
myXlmHttpRequest.onreadystatechange=chuli;
myXlmHttpRequest.send(null);
}
}
function $(id){
return document.getElementById(id);
}
function chuli(){
window.alert("处理函数被调用" + myXlmHttpRequest.readyState);
}
</script>
</head>
<body>
<form action="??" method="post">
用户名字:<input type="text" name="username1" id="username">
<input type="button" onclick="checkeName();" value="验证用户名">
<input style="border-width: 0;color:red" type="text" id="myres">
<br/>
用户密码:<input type="password" name="password"><br/>
用户邮件:<input type="text" name="email"><br/>
<input type="submit" value="用户注册">
</form>
</body>
</html> 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏5(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询