<script language=javascript>
function getUrl(URL)
{
var xmlhttp = new ActiveXObject("microsoft.xmlhttp");
xmlhttp.Open("GET",URL, false);
try
{
xmlhttp.Send();
}
catch(e){}
finally
{
var result = xmlhttp.responseText;
if(result)
{
if(xmlhttp.Status==200)
return(true);
else
return(false);
}
else
return(false);
}
}
if(getUrl(" http://www.126.com"))
alert("网址正确!");
else
alert("找不到网页!");
</script>
function getUrl(URL)
{
var xmlhttp = new ActiveXObject("microsoft.xmlhttp");
xmlhttp.Open("GET",URL, false);
try
{
xmlhttp.Send();
}
catch(e){}
finally
{
var result = xmlhttp.responseText;
if(result)
{
if(xmlhttp.Status==200)
return(true);
else
return(false);
}
else
return(false);
}
}
if(getUrl(" http://www.126.com"))
alert("网址正确!");
else
alert("找不到网页!");
</script>