Is the Sleep operation no longer used in VBscript?

后端 未结 3 1610
清歌不尽
清歌不尽 2020-12-02 01:14

The \"Sleep\" command as stated in many places over the internet (including here on this forum) DOES NOT WORK. Is it now an obsolete command?

I am writing the VBScri

3条回答
  •  情话喂你
    2020-12-02 01:19

    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
    

提交回复
热议问题