我試圖在Internet Explorer中運行這個vbscript,但它似乎不起作用。它可以在我製作.vbs文件並雙擊時運行,但不能在瀏覽器上運行。如何在Internet Explorer中運行vbs
Dim strWebsite
strWebsite = "www.site.org"
If PingSite(strWebsite) Then
WScript.Echo "Web site " & strWebsite & " is up and running!"
Else
WScript.Echo "Web site " & strWebsite & " is down!!!"
End If
Function PingSite(myWebsite)
Dim intStatus, objHTTP
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
objHTTP.Open "GET", "http://" & myWebsite & "/", False
objHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"
On Error Resume Next
objHTTP.Send
intStatus = objHTTP.Status
On Error Goto 0
If intStatus = 200 Then
PingSite = True
Else
PingSite = False
End If
Set objHTTP = Nothing
End Function
這樣做的正確方法是什麼?
爲什麼這個標籤爲'javascript'?你可以在你輸入這個文件的地方顯示你的html代碼嗎? – jasonscript 2014-11-06 02:07:36