您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

XmlHttp异步获取网站数据的代码案例分析

2025/6/3 1:19:24发布27次查看
xmlhttp异步获取网站数据的代码案例分析
<script> var odiv var xh  function getxml() { odiv = document.all.m odiv.innerhtml = "正在装载栏目数据,请稍侯......." odiv.style.display= "" xh = new activexobject("microsoft.xmlhttp") xh.onreadystatechange = getready xh.open("get",a.value,true) xh.send() } function getready() { if(xh.readystate==4) {   if(xh.status==200)   {   odiv.innerhtml = "完成"   }   else   {   odiv.innerhtml = "抱歉,装载数据失败。原因:" + xh.statustext   } } } </script> <body>
xmlhttp异步的例子:
url:<input name=a value="http://bianceng.cn" style="width:600px"> <input onclick="getxml()" type="button" value="得到源代码"> <input onclick="if(xh && xh.responsetext) {alert(xh.responsetext);odiv.innerhtml=xh.responsetext}" type="button" value="显示源代码"> <div id=m></div>
以上就是xmlhttp异步获取网站数据的代码案例分析的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product