这是我在 ajax 中的第一个代码......请任何人都可以帮助我...... readySTate 和 status 属性永远不会成为真的......它显示 xhrobj.readyState=1 和 xhrobj.status=0 ..??
<html>
<head>
<title>MISCELLANEOUS QUESTION NO.1</title>
<script language="javascript">
var xhrobj=false;
if(window.XMLHttpRequest)
xhrobj=new XMLHttpRequest();
else if(window.ActiveXObject)
xhrobj=new ActiveXObject("Microsoft.XMLHttp");
function change1(str)
{
if(xhrobj)
{
var obj=document.getElementById('span1');
xhrobj.open("GET",str);
xhrobj.onreadystatechange=function()
{
if(xhrobj.readyState==4&&xhrobj.status==200)
{
var str1="You Entered...."+str;
obj.innerHTML=xhrobj.responseText;
}
}
var str1="You Entered...."+str;
alert(str1);
alert(xhrobj.readyState);
alert(xhrobj.status);
alert(xhrobj.onreadystatechange);
xhrobj.send(null);
}
}
</script>
</head>
<body>
<form>
<input type="text" id="t1" placeholder="Enter Text...">
<input type="button" onclick="change1(t1.value)" value="FETCH DETAILS OF TEXTBOX">
<br>
</form>
<div id="span1">You Entered....</div>
</body>
</html>
请帮帮我..