El código es el siguiente:
<Input type = text id = http size = 28 style = "color: 888888" valor = "http://www.haiyangtop.net">
<input type = button onClick = vbs: isExist (http.value) valor = "detección de si la url existe" style = "color: 8888888">
<div id = "t"> </div>
<Script Language = VBS>
función isexist (URL)
dic = "c: /dic.dic"
Establecer fso = createObject ("scripting.filesystemObject")
establecer zidian = fso.opentextfile (Dic, 1, falso)
Hacer mientras zidian.atendofstream <> verdadero
ruta = zidian.readline
establecer xmlhttp = createObject ("Microsoft.xmlhttp")
xmlhttp.open "get", http.value+ruta, falso
xmlhttp.send
t.innerhtml = t.innerhtml & url & rath & "----------" & xmlhttp.status & "<br>"
bucle
Función final
</script>
Escritura de versión JS:
Si cambia JS, elimine el "VBS:" en "onClick = VBS: isExist (http.value)" en la segunda línea
El código es el siguiente:
<script>
función isexist (URL)
{
var myObject = new Object ();
myObject.lcx1 = "/admin/index.asp";
myObject.lcx2 = "/Safety";
myObject.lcx3 = "/SafetyX";
para (lcx en myobject)
{
xmlhttp = new ActiveXObject ("Microsoft.xmlhttp")
xmlhttp.open ("get", http.value+myobject [lcx], falso)
xmlhttp.send ()
if (xmlhttp.status == 200)
t.innerhtml+= url+myObject [lcx]+"existencia <br>";
demás
t.innerhtml+= url+myObject [lcx]+"no existen <br>";
}
}
</script>
El método de escritura del diccionario colocado en la versión VBScript:
El código es el siguiente:
<Script Language = VBS>
función isexist (URL)
Oscuro
Establecer d = createObject ("scripting.dictionary")
d.add "a", "/admin/index.asp"
d.Add "B", "/Safety"
d.Add "C", "/SafetyX"
A = D. Keyeys
Para i = 0 a D.Count -1 'atraviesa la matriz.
establecer xmlhttp = createObject ("Microsoft.xmlhttp")
xmlhttp.open "get", http.value+d.item (a (i)), falso
xmlhttp.send
Si xmlhttp.status = 200 entonces
t.innerhtml = t.innerhtml+url+d.item (a (i))+"existir <br>"
demás
t.innerhtml = t.innerhtml+url+d.item (a (i))+"no existen <br>"
final si
Próximo
función final
</script>
El código es el siguiente:
<Input type = text id = http size = 28 style = "color: 888888" valor = "http://www.haiyangtop.net">
<Input type = button onClick = isExist (http.value) value = "Open Dictionary to Guess" style = "Color: 8888888">
<div id = "t"> </div>