日期:2014-05-16 浏览次数:20635 次
<script language="javascript"> function initIt() { pic("2.html?t="+new Date(),"mod_content_1"); pic("2.html?t="+new Date(),"mod_content_2"); } onload = initIt; function GetXmlHttp(){ if(window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); }else if(window.ActiveXObject){ xmlhttp=new ActiveXObject("Microsoft.XMLHttp"); } return xmlhttp; } //主要函数httpurl为你要调用的URL地址 function pic(httpurl,objid){ var xmlhttp=GetXmlHttp(); var url=httpurl; xmlhttp.onreadystatechange=function(){callback(objid);} xmlhttp.open("get",url,false); xmlhttp.send(null); } //返回值函数yj为前台调用DIV的ID function callback(objid){ var objdiv1=document.getElementById(objid); if(xmlhttp.readyState==1){ objdiv1.innerHTML="正在加载数据"; } if(xmlhttp.readyState==4&&xmlhttp.status==200){ var info=xmlhttp.responseText; objdiv1.innerHTML=info; } } </script> <div id=mod_content_1 style=" background:#EEE"></div> <div id=mod_content_2></div>