<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script  language="javascript">
var xmlhttp=false;
function createhttp()
{
  if(window.ActiveXObject) 
  {
   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if(window.XMLHttpRequest)
  {
   xmlHttp = new XMLHttpRequest();
   }
}
function  starrequest()
{
   createhttp();
   alert("ok");
   var url = queryURL();
   
   xmlhttp.onreadystatechange = handleStateChange;
   xmlhttp.open("GET",url,true);
   xmlhttp.send(null);
}
function queryURL()
{
  var url ="http://weather.tq121.com.cn/mapanel/index1.php?city="+"武汉" ;
  return url;
}
function  handleStateChange()
{
 if(xmlhttp.readyState==4)
 { 
   if(xmlhttp.status==200)
   {
      document.getElementById("weather").innerHTML = xmlhttp.responseText;
   }
   else
   {
     document.getElementById("weather").innerHTML = "加载文件中,请等待";
   }
 }
 else
 {
    document.getElementById("weather").innerHTML = "出现错误";
 }
}}
</script>
</head><body onload="starrequest()">
<div id="weather" />
</body>
</html>

解决方案 »

  1.   

    是不是不能运行啊?
    问题在这里:http://weather.tq121.com.cn/mapanel/index1.php?city="+"武汉"
    这是访问你网站外面的网址,js默认这种操作是不安全的不予执行!
      

  2.   

     var url = http://weather.tq121.com.cn/mapanel/index1.php?city="+encodeURI(docTitle);我还不知道怎么了呢楼主不能说明一下吗
      

  3.   


    你把index1.php页面的代码也粘上来
      

  4.   

    作一个客户端代理,这个比较不简单!!
    使用服务器段请求,然后再将内容给客户端!
    或者直接使用Iframe来,这个最简单了!