Greelmo
06-10-2003, 08:02 PM
I have 2 different functions to start and stop a sequence. In the first one, i have a line like this...
var dexter=setTimeout("fncName", 10);
how do i discontinue that in a separate function???? This is very important because i cannot move on until i solve this problem. Help is REALLLLLLLY appreciated!
Thanks
havik
06-10-2003, 08:08 PM
This should work
clearTimeout(dexter);
Havik
Greelmo
06-11-2003, 02:29 PM
there is still one problem though... i'll post the two functions so you can have a look...
function fncexpand(Changeby, myImage)
{
var owidth=myImage.width;
var maxw=120;
var neww=owidth + Changeby;
if (owidth<=maxw){
myImage.width=neww;
var dexter=setTimeout("fncexpand(20, document.item1)", 1);}
}
and....
function fnckill(myImage)
{
if (dexter){
clearTimeout(dexter);}
myImage.width=25;
}
obviously, i want the width of an image to expand when the mouse goes over it, but if you take off the mouse before the expansion is done, it goes to 25 in width, but then expands again and you can't reverse it until it's all the way done. I'm sure there is a way to do this. There are 5 of these images too, so this sparks another question... notice in the first function how it only specifies "document.item1" in the "setTimeout()" method. Is there a way to make it non-specific and read the variable "myImage" so that i don't have to do this function 5 times? When i do this.... setTimeout("fncexpand(20, myImage)", 1", I get a warning reading "dexter is undefined". Any suggestions?