jtp101
asked on
window.clearTimeout() in IE3
The window.clearTimeout() method doesn't seem to work in IE3, is it part of IE3s Jscript? and if it isn't how can I stop a function called by a window.setTimeout() coming into effect?
Any help would be greatly appreciated.
Any help would be greatly appreciated.
clearTImeout should work fine in IE 3. Martin's code should work for you though if the clearTimeout still doesn't work.
Just out of curiosity though, what's your code look like? I was just wondering if maybe it was coded wrong or something.
-Josh
Just out of curiosity though, what's your code look like? I was just wondering if maybe it was coded wrong or something.
-Josh
ASKER
Hi there Josh
This is the part of the code which gives me the error.
The idea is that when a user of my site moves their mouse pointer over an image, help text for that image is displayed in another
frame.
when the mouse is moved over the image, helptextchange() is called which puts the correct file in the help text window and sets
up a window.setTimeout() to change the help text window back to normal after 6 seconds, the problem is that if the mouse
pointer is moved over another image, say 5 seconds after the first, the new helptext is called up and 1 second later taken away
(because the first window.setTimeout() is still active) therefore I need to cancel the first window.setTimeout().
I would have liked to use a "onMouseOut" to change the text back to normal bu that isn't supported my IE3 either.
Code Below:
var htbtn=null;
function helptextchange(thehelptext filename) {
parent.helptext.location.h ref= "http://www.jtp.dircon.co.uk/whisky/helptext/" + thehelptextfilename;
window.clearTimeout(htbtn) ;
htbtn = window.setTimeout('helptex ttonormal( )',6000);
}
}
function helptexttonormal() {
parent.helptext.location.h ref= "http://www.jtp.dircon.co.uk/whisky/helptext/helptext.htm";
}
From
Justin
This is the part of the code which gives me the error.
The idea is that when a user of my site moves their mouse pointer over an image, help text for that image is displayed in another
frame.
when the mouse is moved over the image, helptextchange() is called which puts the correct file in the help text window and sets
up a window.setTimeout() to change the help text window back to normal after 6 seconds, the problem is that if the mouse
pointer is moved over another image, say 5 seconds after the first, the new helptext is called up and 1 second later taken away
(because the first window.setTimeout() is still active) therefore I need to cancel the first window.setTimeout().
I would have liked to use a "onMouseOut" to change the text back to normal bu that isn't supported my IE3 either.
Code Below:
var htbtn=null;
function helptextchange(thehelptext
parent.helptext.location.h
window.clearTimeout(htbtn)
htbtn = window.setTimeout('helptex
}
}
function helptexttonormal() {
parent.helptext.location.h
}
From
Justin
ASKER
Hi Martin
Thanks for your comment, but at the same time as the first setWindowTimeout() is cancelled I need to create another setWindowTimeout() assigned to the same variable as the first one, and that won't come into effect either using your method (because runTimer would be equal to 0, and if you didn't set it to 0 the first setWindowTimeout() would still come into effect).
Have a look at my code in the other comment I have posted if you're interested.
Thanks again
From
Justin
Thanks for your comment, but at the same time as the first setWindowTimeout() is cancelled I need to create another setWindowTimeout() assigned to the same variable as the first one, and that won't come into effect either using your method (because runTimer would be equal to 0, and if you didn't set it to 0 the first setWindowTimeout() would still come into effect).
Have a look at my code in the other comment I have posted if you're interested.
Thanks again
From
Justin
OK, I'm not sure if this will work, but try this:
counter=0;
function helptextchange(thehelptext filename)
{parent.helptext.location. href= "http://www.jtp.dircon.co.uk/whisky/helptext/" + thehelptextfilename;
counter++;
window.setTimeout('helptex ttonormal( )',6000);
}
function helptexttonormal()
{counter--;
if (counter==0)
parent.helptext.location.h ref= "http://www.jtp.dircon.co.uk/whisky/helptext/helptext.htm";
}
The theory is right, so if I had the semantics slightly off and it doesn't work, I'll try to fix it by actually testing with dummy pages.
Good luck,
Josh
counter=0;
function helptextchange(thehelptext
{parent.helptext.location.
counter++;
window.setTimeout('helptex
}
function helptexttonormal()
{counter--;
if (counter==0)
parent.helptext.location.h
}
The theory is right, so if I had the semantics slightly off and it doesn't work, I'll try to fix it by actually testing with dummy pages.
Good luck,
Josh
ASKER
Hi Josh
Sorry I disappeared (Had to go away for a few days)
Your method should work perfectly! so if you re-post it as a proposed answer then I will
give you the points.
Thanks very much.
From
Justin
P.S. any Idea why the clearTimeout() is not working?
Sorry I disappeared (Had to go away for a few days)
Your method should work perfectly! so if you re-post it as a proposed answer then I will
give you the points.
Thanks very much.
From
Justin
P.S. any Idea why the clearTimeout() is not working?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cheers Josh.
timerId = setTimeout('runByTheTimer(
runTimer = 1;
.
clearTimeout(timerId);
runTimer = 0;
.
function runByTheTimer() {
if (!runTimer) return;
...
}
Martin