www.webdeveloper.com
Results 1 to 8 of 8

Thread: frame image flipping

  1. #1
    Join Date
    Nov 2002
    Posts
    2

    Angry 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

  2. #2
    Join Date
    Nov 2002
    Posts
    631
    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.

  3. #3
    Join Date
    Nov 2002
    Posts
    421
    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.

  4. #4
    Join Date
    Nov 2002
    Posts
    4,473
    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;

  5. #5
    Join Date
    Nov 2002
    Posts
    421
    oops - sorry - yes no quotes on the variable. i must have been half asleep.

  6. #6
    Join Date
    Nov 2002
    Posts
    2
    Thank you all for your help but I still have the problem. I tried everything, I don't understand...

  7. #7
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    44
    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'.

  8. #8
    Join Date
    Nov 2002
    Posts
    421
    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
  •  
HTML5 Development Center



Recent Articles