代码如下:
<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 ' 遍历数组。
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=打开字典进行猜解 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, 请确认 ) 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>
最后一个比较好用