Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoEvents? 1

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
In the window_onload event I want to set the innerText of a span tag and then run some code. The problem is that the span tag does not reflect the change until the other code has completed running. Is there something like a DoEvents that forces the page to update before any more code is processed? Or is there another event I could place the code in?

Here's an example of my code:
Code:
Sub window_onload()
    lblMySpanTag.innerText = "abc"
    Call RunSomeCode
End Sub

Sub RunSomeCode()

End Sub
 
I would be surprised if a simple operation of setting innerText need time delay. In any case, it is something like this.
[tt]
Sub window_onload()
lblMySpanTag.innerText = "abc"
[red]'[/red]Call RunSomeCode
[blue]call pre_RunSomeCode[/blue]
End Sub

Sub RunSomeCode()

End Sub

[blue]sub pre_RunSomeCode
if lblMySpanTag.innerText <> "abc" then
setTimeout "pre_RunSomeCode",50
else
call RunSomeCode
end if
end sub[/blue]
[/tt]

 
This is a routine issue (i.e. the need arises in lots of cases) and tsuji has supplied the most common solution.

The only alternative I'm aware of is to call RunSomeCode in response to a subsequent "onclick" or other user-initiated event.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top