<% 'Asp代码 dim strURL dim objXmlHttp dim status strURL = "http://www.csdn.net"'前面一定要加上http:// set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP") objXmlHttp.Open "GET",strURL, false objXmlHttp.Send status = objXmlHttp.Status set objXmlHttp = nothing %>
=============================<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="pragma" content="no-cache" />
<style type="text/css">
<!--
-->
</style>
<script language="JavaScript">
<!--
function CheckUrl(str){
var oHttp=new ActiveXObject("Microsoft.XMLHTTP") ;
oHttp.open('get',str,false);
oHttp.send('');
if(oHttp.status==404)
{
alert('找不到网页');
return;
}
if(oHttp.status==200)
{
alert('打开正常!');
return;
}
if(parseInt(oHttp.status/100)==5)
{
alert('服务器内部错误');
return;
}
}
-->
</script>
<title></title>
</head>
<body>
<input type="text" value="http://www.goole.com/" id="urlTest" size="30" />
<input type="button" onclick="javaScript:CheckUrl(urlTest.value);" value="测试" />
</body>
</html>
http://community.csdn.net/Expert/topic/3472/3472337.xml?temp=.1701624
'Asp代码
dim strURL
dim objXmlHttp
dim status strURL = "http://www.csdn.net"'前面一定要加上http://
set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
objXmlHttp.Open "GET",strURL, false
objXmlHttp.Send
status = objXmlHttp.Status
set objXmlHttp = nothing
%>