【发布时间】:2014-11-06 01:53:01
【问题描述】:
我试图在 Internet Explorer 中运行这个 vbscript,但它似乎不起作用。当我将其制作为 .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 代码吗?
标签: internet-explorer vbscript