首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

初学有关问题,高手帮忙看看

2011-12-20 
初学问题,高手帮忙看看WebForm1.aspx的一段脚本如下xmlHTTP.open( GET , WebForm2.aspx ,true)if(xml

初学问题,高手帮忙看看
WebForm1.aspx
的一段脚本如下
xmlHTTP.open( "GET ", "WebForm2.aspx ",true);
if(xmlHTTP.readyState==4)
  alert(xmlHTTP.ResponseText);
  xmlHTTP.send(null);

WebForm2.aspx
中只有一句
Response.Write( " <input   type= 'text '   width= '200px '> ");

怎么什么都没有返回
请问差什么代码帮忙补一下

[解决办法]
function ajaxComplete()
{
if(xmlhttp.readyState == 4 )
{
//dosomething
}
}
function ajaxrequest( url )
{
xmlhttp = new ActiveXObject( "Msxml2.XMLHTTP ");
//你该这样关联处理函数来实现回调,而非直接写在下面,直接写在下面的话,open里用false
xmlhttp.onreadystatechange=ajaxComplete;
xmlhttp.open( "GET ", url, true);
xmlhttp.send();
}
[解决办法]
你没有指定返回的处理函数!当然没有反映了!
<script language= "javascript ">
var xmlobj=false;
function send_request(url){
xmlobj=false;
xmlobj=new ActiveXObject( "Microsoft.XMLHTTP ");
xmlobj.onreadystatechange=data_Deal;
xmlobj.open( "GET ",url,true);
xmlobj.send(null);
}

function data_Deal(){
if(ht.readyState==4){
if(ht.status==200){
document.write(xmlobj.responseText); //获取返回值
}
else{
alert(xmlobj.status)
}
}
}

</script>

热点排行