-
Doevents in JS?!?!?!?!
Hi everyone! I've got this code which is called to scroll my div tag.
Code:
function ScrollDIVDown()
{
blnKeepScrolling = true;
while (blnKeepScrolling = true)
{
document.getElementById('divToScroll').scrollTop =
document.getElementById('divToScroll').scrollTop + intScrollIncrement;
}
}
Now this one's called when the user hovers their mouse over an image, when the mouseout event of the same image occurs, I'm trying to alter the variable & therefore exit the loop - but the loop keeps on continuing and the mouseout event never gets fired! Is there a better way to do this please, or is there a JS doevents equivalent?
Code:
<IMG SRC="images/ScrollArrow_Up.jpg" onmouseover="Javascript: ScrollDIVDown()"
onmouseout="javascript: blnKeepScrolling=false;">
Thanks!!
-
change
while (blnKeepScrolling = true)
to
while (blnKeepScrolling == true)
I assume blnKeepScrolling is global
-
Drat missed that one - thanks for spotting that! ;) unfortunatley though, this doesn't make it work though....
-
Then I assume the onMouseout won't get fired until the onmouseOver function has finished, and this won't finish because it's in an infinite loop.
Within the ScrollDIVDown function's loop is there a way to check if the mouse is over the image and if not exit loop.
-
Guess I could do an event check function, yep will check this out thanks! :)