xmlhttp 为空 或不是对象,哪错了??
于娜 2008-07-13 10:54:17 <script language="javascript" type="text/javascript">
var xmlhttp;
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
}
function startCollect()
{
xmlhttp = createXMLHttpRequest();
xmlhttp.open("GET","Index2.aspx",true);
xmlhttp.onreadystatechange = stateChange;
xmlhttp.send(null);
}
function stateChange()
{
if(xmlhttp.readystate==4 && xmlhttp.status==200)
{
var data = xmlhttp.responseText;
document.getElementById("txtName").value = data;
}
}
</script>