ajax基本實現...
时间:2010-08-15 来源:yoyoch1
var vXMLHttp;
function CXMLHttp() {
if (window.ActiveXObject) {
vXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
vXMLHttp = new XMLHttpRequest();
}
}
function SendMessage() {
CXMLHttp() ;
vXMLHttp.onreadystatechange=DoMessage;
url="test.aspx" ;
vXMLHttp.open("GET",url,true);
vXMLHttp.send();
}
function DoMessage() {
if (vXMLHttp.readyState==4) {
document.forms[0].elements['txtMessage'].value=vXMLHttp.responseText;
}
}