Guest_imported
New member
- Jan 1, 1970
- 0
the problem:
i want an image on my website to toggle between two states everytime the user drags the mouse over it.
i've written the following script:
<script language="javascript">
<!--
var imgvec = new Array("img/img1.gif", "img/img2.gif"
function toggle(source, imgsrc1, imgsrc2)
{
if(source.src == imgvec
)
{
source.src = imgvec
;
return;
}
source.src = imgvec
;
}
//-->
</script>
my image-tag is like this:
<img src="img/img2.gif" onMouseOver="toggle(this, 0, 1)">
when i drag the mouse over the image the first time, it changes to img1.gif correctly. the second time i drag over the image it does not change back. the if() block is never executed...
has anyone an idea why?
i want an image on my website to toggle between two states everytime the user drags the mouse over it.
i've written the following script:
<script language="javascript">
<!--
var imgvec = new Array("img/img1.gif", "img/img2.gif"
function toggle(source, imgsrc1, imgsrc2)
{
if(source.src == imgvec
{
source.src = imgvec
return;
}
source.src = imgvec
}
//-->
</script>
my image-tag is like this:
<img src="img/img2.gif" onMouseOver="toggle(this, 0, 1)">
when i drag the mouse over the image the first time, it changes to img1.gif correctly. the second time i drag over the image it does not change back. the if() block is never executed...
has anyone an idea why?