...

View Full Version : Another function again not working.



SpiritualStorms
06-27-2004, 05:40 PM
I need help detecting the error in this:


function imageFlips(paramOne, paramTwo)
{
if(document.images)
{
document.image.paramOne.src=paramTwo;
}
else
{
alert("There's no image by the name of "+paramOne);
}
}

I call the above with the following code:


<br>
<a href="javascript:onMouseOver="imageFlips('flower','triangle.bmp');">
<img id="flower" src="flower.bmp">
</a>
<br>

I do not know why the onMouseOver event-handler does not call the function.

DooM_MonkeY
06-27-2004, 05:46 PM
try <a href="javascript:void(0);" onmouseover="your function here" >

SpiritualStorms
06-27-2004, 06:00 PM
Still not working. Funny thing is, that the alert part works. And it tells me theres no image by that name, when in fact there is one. LOL.

Willy Duitt
06-27-2004, 06:03 PM
document.images[paramOne].src=paramTwo;

SpiritualStorms
06-27-2004, 07:28 PM
It worked. And i was gonna try the paramOne within the images array, but i somehow second guessed myself. anyways, i had to throw in the s part in the document.image array, to make it document.images[].

In the end, it worked. And i even tried a reversal of the code a little, and that too worked. Here's my code:


<br>
<a href="javascript:void(0);"

onmouseover="imageFlips('flower','triangle.bmp');"
onmouseout="imageFlips('flower','flower.bmp');">
<img id="flower" src="flower.bmp">
</a>
<br>

I threw in the onmouseout event-handler to see if i could reverse the flip, and it worked.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum