javascript判断网址是否有效

<SCRIPT LANGUAGE="JavaScript">
function isExist(url) {
 try
 {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
   xmlhttp.open("GET",url,false)
   xmlhttp.send()
   if(xmlhttp.status==200)
   alert(url+"存在")
   else
   alert(url+"不存在")
 }
 catch(err)
 {
    alert("没有开通")
 }
}
</SCRIPT>
<input type="button" onclick="isExist('http://s192.19.19.13/SuperTeacherResource/unblocked.aspx')" value="url是否存在">
posted @ 2006-11-13 19:17  dayang  Views(760)  Comments(0)    收藏  举报