报错
NetworkError: Failed to execute 'send' on 'XMLHttpRequest': failed to load '
http://www.baidu.com'.换其他url也不行,实在看不出问题在哪,求教
<!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=utf-8" />
<title>Hottest News</title>
<body onload='GetData()'>
<script type="text/javascript">
var xmlhttp;
function GetData()
{
url = "http://www.baidu.com";
str = loadXMLDoc(url);
alert(str);
}
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for all new browsers
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE5 and IE6
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET",url,false);
try
{
xmlhttp.send();
return xmlhttp.responseText;
}
catch(e)
{
alert(e);
return null;
}
}
else
{
alert("Your browser does not support XMLHTTP.");
return null;
}
}
function state_Change()
{
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if (xmlhttp.status==200)
{// 200 = OK
// ...our code here...
alert(2);
}
else
{
alert("a");
}
}
}
</script>
</body>
</html>
--
FROM 222.131.1.*