frame image flipping
Hello!
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.
Here's my source code:
<html>
<head>
<script language="JavaScript">
<!--
btn_unsel=new Image();
btn_unsel.src="btn_unsel.gif";
btn_sel=new Image();
btn_sel.src="btn_sel.gif";
//-->
</script>
</head>
<body>
<a href="whatever.html" target="main_frame"
onmouseover="btn.src='btn_sel.gif'"
onmouseout="btn.src='btn_unsel.gif'">
<img name="btn" border=0 src="btn_unsel.gif">
</a>
</body>
</html>
Any idea? Thanks.
Robino
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.
Last edited by Zach Elfers; 11-22-2002 at 06:43 PM .
document.btn.src='btn_sel.src'
you also have the wrong name for the source. you are using the gif again rather than the variable where you stored it.
Originally posted by Beach Bum
document.btn.src='btn_sel.src'
you also have the wrong name for the source. you are using the gif again rather than the variable where you stored it.
If that is true, then you don't want the VAR inside quotes. It should be:
document.btn.src = btn_sel.src;
oops - sorry - yes no quotes on the variable. i must have been half asleep.
Thank you all for your help but I still have the problem. I tried everything, I don't understand...
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'.
no ; needed in our example. the ; is ued to separate more than one script statement.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks