代碼如下:
<input type=text id=http size=28 style=color:888888 value=http://www.haiyangtop.net>
<input type=button onclick=vbs:isexist(http.value) value=檢測url是否存在 style=color:888888>
<div id=t></div>
<script language=vbs>
function isexist(url)
dic=c:\dic.dic
set fso = createobject(scripting.filesystemobject)
set zidian=fso.opentextfile(dic,1,false)
do while zidian.atendofstream <> true
path=zidian.readline
set xmlhttp = createobject(microsoft.xmlhttp)
xmlhttp.open get,http.value+path,false
xmlhttp.send
t.innerhtml = t.innerhtml&url&path&--------&xmlhttp.status&<br>
loop
end function
</script>
js版寫法:
如果換js,要將第二行的“onclick=vbs:isexist(http.value)”里的vbs:去掉
代碼如下:
<script>
function isexist(url)
{
var myobject = new object();
myobject.lcx1 = /admin/index.asp;
myobject.lcx2 = /safety;
myobject.lcx3 = /safetyx;
for (lcx in myobject)
{
xmlhttp = new activexobject(microsoft.xmlhttp)
xmlhttp.open(get,http.value+myobject[lcx],false)
xmlhttp.send()
if(xmlhttp.status==200)
t.innerhtml += url+myobject[lcx]+存在<br>;
else
t.innerhtml+= url+myobject[lcx]+不存在<br>;
}
}
</script>
字典放在頁面里的寫法vbscript版:
代碼如下:
<script language=vbs>
function isexist(url)
dim d
set d = createobject(scripting.dictionary)
d.add a,/admin/index.asp
d.add b, /safety
d.add c, /safetyx
a = d.keys
for i = 0 to d.count -1 ' 遍歷數(shù)組。
set xmlhttp = createobject(microsoft.xmlhttp)
xmlhttp.open get,http.value+d.item(a(i)),false
xmlhttp.send
if xmlhttp.status=200 then
t.innerhtml = t.innerhtml+url+d.item(a(i))+存在<br>
else
t.innerhtml = t.innerhtml+url+d.item(a(i))+不存在<br>
end if
next
end function
</script>
代碼如下:
<input type=text id=http size=28 style=color:888888 value=http://www.haiyangtop.net>
<input type=button onclick=isexist(http.value) value=打開字典進(jìn)行猜解 style=color:888888>
<div id=t></div>
<script language=vbs>
function isexist(url)
set objfile = createobject(safrcfiledlg.fileopen)
intret = objfile.openfileopendlg
if intret then
dic= objfile.filename
end if
if dic<> then
set fso = createobject(scripting.filesystemobject)
set zidian=fso.opentextfile(dic,1,false)
if 2 = msgbox( 字典為: & objfile.filename & vbcrlf & 您確定嗎?, 32 + 1, 請確認(rèn) ) then isexist(http.value)
do while zidian.atendofstream <> true
path=zidian.readline
set xmlhttp = createobject(microsoft.xmlhttp)
xmlhttp.open get,http.value+path,false
xmlhttp.send
t.innerhtml = t.innerhtml&url&path&--------&<font color=red>&xmlhttp.status&</font><br>
loop
end if
end function
</script>
最后一個比較好用