frame image flipping

liunx

Guest
Hello!<br />
<br />
I tried to flip some images in a HTML page. It worked fine but if I put it into a frame, images are all the time dowloaded from server. <br />
Here's my source code:<br />
<br />
<html><br />
<head><br />
<script language="JavaScript"><br />
<!--<br />
btn_unsel=new Image();<br />
btn_unsel.src=http://www.webdeveloper.com/forum/archive/index.php/"btn_unsel.gif";<br />
btn_sel=new Image();<br />
btn_sel.src=http://www.webdeveloper.com/forum/archive/index.php/"btn_sel.gif";<br />
//--><br />
</script><br />
</head><br />
<body><br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"whatever.html" target="main_frame"<br />
onmouseover="btn.src='http://www.webdeveloper.com/forum/archive/index.php/btn_sel.gif'"<br />
onmouseout="btn.src='http://www.webdeveloper.com/forum/archive/index.php/btn_unsel.gif'"><br />
<img name="btn" border=0 src=http://www.webdeveloper.com/forum/archive/index.php/"btn_unsel.gif"><br />
</a><br />
</body><br />
</html><br />
<br />
Any idea? Thanks. <br />
<br />
Robino<!--content-->Your image has a name, btn. In the link where it says onmouseover, don't just put btn.src. Put document.btn.src. That should work.:)<!--content-->document.btn.src='http://www.webdeveloper.com/forum/archive/index.php/btn_sel.src'<br />
<br />
you also have the wrong name for the source. you are using the gif again rather than the variable where you stored it.<!--content-->Originally posted by Beach Bum <br />
document.btn.src='http://www.webdeveloper.com/forum/archive/index.php/btn_sel.src'<br />
<br />
you also have the wrong name for the source. you are using the gif again rather than the variable where you stored it. <br />
<br />
If that is true, then you don't want the VAR inside quotes. It should be:<br />
<br />
document.btn.src = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/btn_sel.src;">http://www.webdeveloper.com/forum/archi ... n_sel.src;</a><!-- m --><!--content-->oops - sorry - yes no quotes on the variable. i must have been half asleep.<!--content-->Thank you all for your help but I still have the problem. I tried everything, I don't understand...:confused:<!--content-->Uh, I'm not too sure, but do you need a semicolon ( ; ) after your event handlers? I always put one in after an 'onMouseOver' and 'onMouseOut'.<!--content-->no ; needed in our example. the ; is ued to separate more than one script statement.<!--content-->
 
Back
Top