文章内容
用 xmlhttp 判断 url 是否存在
作者:未知 来源:网络收集 录入:管理员
〈SCRIPT LANGUAGE=“javascript“〉
function isExist(url) {
xmlhttp = new ActiveXObject(“Microsoft.XMLHTTP“)
xmlhttp.open(“GET“,url,false)
xmlhttp.send()
if(xmlhttp.status==200)
alert(url+“ 存在“)
else
alert(url+“ 不存在“)
}
〈/SCRIPT〉
〈input type=“button“ onclick=“isExist(’替换www.sayee.com/cloudchen/js/myCalendar.htm’)“ value=“检测url是否存在“〉
///asp 代码:
Function getHTTPPage(url)
dim http
set http=Server.createobject(“Microsoft.XMLHTTP“)
Http.open “GET“,url,false
Http.send()
if Http.readystate 〈〉 4 then
exit function
else
getHTTPPage = http.status
end if
set http=nothing
if err.number〈〉0 then err.Clear
end function