一个实现VBS倒计时的代码
以下内容为程序代码:
<script language="VBScript">
Dim oTime : oTime = 5
Function STime
document.all("oInput").value = "00:00:" & oTime
If oTime>0 Then
oTime = oTime - 1
window.setTimeout "STime", 1000
Else
MsgBox "时间到了!"
End If
End Function
Sub Window_Onload
Call STime
End Sub
msgbox(value)
</script>
<input id="oInput" type="text">
把上面这段保存为001.html可以成为一个完整的倒计时器,哪位帮我把他改成VBS一下,让其能变成VBS倒计时器!
复制代码 代码如下:
Set WshShell = CreateObject("WScript.Shell")
Dim CloseTime,i
CloseTime = 5
For i = CloseTime To 1 Step - 1
WshShell.popup "当前时间为" & i,1,"计时",0
Wscript.Sleep 1000
Next
MsgBox "时间到!"
Set WshShell = Nothing