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是否存在">
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是否存在">

浙公网安备 33010602011771号