Le code est le suivant:
<entrée type = Text ID = http size = 28 style = "Color: 888888" value = "http://www.haiyangtop.net">
<entrée type = bouton onclick = vbs: isExist (http.value) value = "détection de si l'URL existe" style = "couleur: 888888">
<div id = "t"> </ div>
<Script Language = VBS>
Fonction Isexist (URL)
dic = "c: /dic.di"
Set fso = createObject ("scripting.fileSystemObject")
Set Zidian = FSO.OpentextFile (DIC, 1, FALSE)
Faire pendant que zidian.atendofstream <> true
chemin = zidian.readline
définir xmlhttp = createObject ("Microsoft.xmlhttp")
xmlhttp.open "get", http.value + chemin, faux
xmlhttp.send
t.innerhtml = t.innerhtml & url & path & "----------" & xmlhttp.status & "<br>"
boucle
Fonction finale
</cript>
Écriture de la version JS:
Si vous modifiez JS, supprimez le "VBS:" dans le "onClick = VBS: iSexist (http.value)" sur la deuxième ligne
Le code est le suivant:
<cript>
Fonction Isexist (URL)
{
var myObject = new Object ();
myObject.lcx1 = "/admin/index.asp";
myObject.lcx2 = "/ Safety";
myObject.lcx3 = "/ SafetyX";
pour (LCX dans 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] + "existence <br>";
autre
t.innerhtml + = url + myObject [lcx] + "n'existe pas <br>";
}
}
</cript>
La méthode d'écriture du dictionnaire placé sur la page VBBScript version:
Le code est le suivant:
<Script Language = VBS>
Fonction Isexist (URL)
Faible
Set d = createObject ("scripting.dictionary")
d.add "a", "/ admin / index.asp"
D.Add "B", "/ Safety"
D.Add "C", "/ SafetyX"
A = D.Keys
Pour i = 0 à D.Count -1 'Traverser le tableau.
définir xmlhttp = createObject ("Microsoft.xmlhttp")
xmlhttp.open "get", http.value + d.item (a (i)), faux
xmlhttp.send
Si xmlhttp.status = 200 alors
t.innerhtml = t.innerhtml + url + d.item (a (i)) + "exister <br>"
autre
t.innerhtml = t.innerhtml + url + d.item (a (i)) + "pas exister <br>"
terminer si
Suivant
fonction finale
</cript>
Le code est le suivant:
<entrée type = Text ID = http size = 28 style = "Color: 888888" value = "http://www.haiyangtop.net">
<entrée type = bouton onclick = iSexist (http.value) value = "ouvrir le dictionnaire pour deviner" style = "couleur: 888888">
<div id = "t"> </ div>