Is the Sleep operation no longer used in VBscript?

Daniel’s answer is absolutely correct about context being the key here. Although you don’t have the WScript method available, you do have the full browser DOM, including the window.setTimeout method. With VBScript, the semantics of passing code to setTimeout are a little bit different than JavaScript, but it’s still possible:

Sub button1_onclick()
    window.setTimeout GetRef("Delayed"), 1000
End Sub

Sub Delayed()
    div1.innerHTML = textbox1.value
End Sub

Leave a Comment