"OM" <OM@yahoo.com> writes:
[color=blue]
> Why doesn't a onmouseover function work in a function?[/color]
I am not sure exactly what you mean.
[color=blue]
> (It's prob due to my code being wrong more than anything else!)
>
> I've got the following code (snippet):
>
> <!-- Begin[/color]
You don't need HTML comments in Javascript.
[color=blue]
> var image0 = new Image(); image0.src = "blank.jpg";
> var image1 = new Image(); image1.src = "map.jpg";
> // End -->
>
> function swapTheImages()
> {
> image0.src='1.jpg'; image1.src='2.jpg'; image2.src='2.jpg';[/color]
What døs image0, image1, and image2 refer to here. The first two
proabably refers to the two global variables you created above.
Changing them won't change anything on the page, unless you
have put those Image elements into the page.
[color=blue]
> }[/color]
[color=blue]
> When I do an onmouseover and call the function, it doesn't work.
> BUT if I put the code in directly - it works![/color]
I guess we will have to see the code to answer that. It seems to be
something about how you all the function, not the function itself,
so we need to see how it is called.
/L
--
Lasse Reichstein Nielsen -
lrn@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'