我有一個非常長的VBScript代碼運行在HTA中。該腳本包括DOM操作,DLL調用和其他腳本。現在我遇到了一個問題,因爲在屏幕上顯示文本需要大量時間,因爲有很多腳本會暫停HTML解析。給HTML時間來呈現其文本
現在我打算創建一個簡單的延遲,這將阻止代碼執行,但不是HTML解析。但我不知道該怎麼做。
更新
這裏是我想要的(對不起,請不要介意HTA VBS語法我是新)
Sub Window_Onload()
Call Main()
End Sub
Sub Main()
Dim delay
el.innerHtml = "Please"
el2.innerHtml = "Help"
el3.innerHtml = "me"
'more scripts here
'more scripts here
'more scripts here
'more scripts here
el4.innerHtml = "this element is dependent to other scripts"
el5.innerHtml = "this element is dependent to other scripts"
el6.innerHtml = "this element is dependent to other scripts"
delay = 2
Call PauseAndRenderHtml(delay) 'this function will block the code execution
'but not the html parsing
'more scripts here
Do While True
'very long scripts that loops and pause, loops and pause........
Loop
End Sub
Sub PauseAndRenderHtml(timeToBreath)
'Take a breath :)
'breath/pause for timeToBreath seconds
End Sub
我需要的功能的示例代碼PauseAndRenderHtml()
你能發佈你的HTA編碼嗎? – Hackoo