@slynxJan 26.2003 — #Have the onMouseOver call a function that has the alert in an if statement that checks a flag variable (set to 0 outside the function. Set the flag to one in a statement after the alert.
@CharlesJan 27.2003 — #[font=georgia]To me that use of anonymous functions is much more logical. And it is consistent with the object oriented nature of JavaScript. See my post towards the end of http://forums.webdeveloper.com/showthread.php?s=&threadid=2852. Also, you need to keep in mind that each line of code in JavaScript carries a great deal of overhead. I always try to keep things as short as possible and I never use a variable if I can avoid it.
But let's consider your example. With the other method proposed, each time the link's onmouseover handler is called, the interpreter has to look up the variable name, get its value, compare it and decide what to do. And at each of those steps a good deal is going on unseen. With my method, the first time the handler is called the alert is called and then the handler overwrites itself. With each subsequent call the handler simply does nothing. Call me nuts, but that seems to make more sense to me.[/font]
@JonaauthorJan 27.2003 — #On the contrary, it makes very good since, Charles. Very good sense. As a matter of fact, I like the way you "code." The shorter the better--especially for the people with the old Windows 3.1 with a 16K modem! Hehe, I don't even think they'll be able to view it! That version of JavaScript wasn't released when I first got online with my 3.1.. Anyways, back to our discussion--your code is very well put together. It is, at first glance, a bit odd, but when explained, makes very good sense. There seems to be more logic in azcn2053's code to me, but I understand variables, loops, etc., which is what he used. In your code, I am unfamiliar with it. Both work, at least on a Windows Me with 360+ MB memory.. Well, I hope to speak with you again, Charles. Your method of coding is very interesting, and I look forward to seeing your other ways of getting around the "long" functions... personally, I always make very short code. Many DHTML scripts are rather lengthy, but I always try to shorten them up a little, because I know what it's like to have a 28.8 and 56K modem.
@CharlesJan 28.2003 — #[font=georgia]If you are wed to the setting a flag method and you still want to keep your code as elegent as possible then try:[/font]