Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: need help with rollover button

  1. #1
    Join Date
    May 2008
    Posts
    9
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default need help with rollover button

    Code:
    <img src="book.gif" name="bookgif" onMouseover="document.bookgif.scr=book2.gif" 
    		onMouseout="document.bookgif.scr=book.gif">
    i need that so it changes from one image to another and when you click it goes to the specified location. when i add in a href it vanishes, if i leave it without the href it doesnt link, but in both instances the image doesnt change. anyone know what im doing wrong?

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Does this work for you?:
    Code:
    <img src="book.gif" name="bookgif" onMouseover="this.scr=\"book2.gif\""
    onMouseout="this.scr=\"book.gif\"" onClick=\"window.location='location here\"">
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Nile View Post
    Does this work for you?:
    Code:
    <img src="book.gif" name="bookgif" onMouseover="this.scr=\"book2.gif\""
    onMouseout="this.scr=\"book.gif\"" onClick=\"window.location='location here\"">
    That won't work for anyone, especially the highlighted part, but the rest looks shaky too. This will work:

    Code:
    <a href="some.htm"><img border=0 src="book.gif" 
    onmouseover="this.src='book2.gif';" 
    onmouseout="this.src='book.gif';"></a>
    There are many other ways. The above is about the simplest and provides non-javascript users at least with the link.
    Last edited by jscheuer1; 06-08-2008 at 09:35 PM. Reason: correct inherited error (scr/src)
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. The Following 2 Users Say Thank You to jscheuer1 For This Useful Post:

    ddadmin (06-08-2008),Vile Demonic (06-03-2008)

  5. #4
    Join Date
    May 2008
    Posts
    9
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post

    Code:
    <a href="some.htm"><img border=0 src="book.gif" 
    onmouseover="this.scr='book2.gif';" 
    onmouseout="this.scr='book.gif';"></a>
    There are many other ways. The above is about the simplest and provides non-javascript users at least with the link.

    oddly its still not changing even doing it this way

    should i have a var or somethign that will load the images ready for roll over or somethign like that?

  6. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Preloading the rollover image(s) is a good idea. However, the main problem with this code is that I copied some of the typos from Nile's monstrosity, which he in turn had copied from you. Notably this.scr for what should have been this.src. Here is the corrected version (sorry for the error):

    Code:
    <a href="some.htm"><img border=0 src="book.gif" 
    onmouseover="this.src='book2.gif';" 
    onmouseout="this.src='book.gif';"></a>
    If this the only rollover you have, a simple preload for it would be a script like this in the head of your page:

    Code:
    <script type="text/javascript">
    var book_rollover=new Image();
    book_rollover.src='book2.gif';
    </script>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Vile Demonic (06-04-2008)

  8. #6
    Join Date
    May 2008
    Posts
    9
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    ahh thank you and sorry i switch letters without noticing from time to time.

  9. #7
    Join Date
    May 2008
    Posts
    9
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    does anyone know why this works in firefox and doesnt link in IE?

  10. #8
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Quote Originally Posted by Vile Demonic View Post
    does anyone know why this works in firefox and doesnt link in IE?
    Links well in IE6. Didn't try IE7.
    ---
    Arie Molendijk

  11. #9
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by jscheuer1 View Post
    That won't work for anyone, especially the highlighted part, but the rest looks shaky too. This will work:

    Code:
    <a href="some.htm"><img border=0 src="book.gif" 
    onmouseover="this.src='book2.gif';" 
    onmouseout="this.src='book.gif';"></a>
    There are many other ways. The above is about the simplest and provides non-javascript users at least with the link.
    Can someone tell me why ddadmin thanked that post?
    Last edited by jscheuer1; 06-08-2008 at 09:37 PM. Reason: correct inherited error (scr/src)
    Jeremy | jfein.net

  12. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Nile View Post
    Can someone tell me why ddadmin thanked that post?
    The ddadmin works in mysterious ways.

    Seriously though, perhaps he appreciates that I noted that your post was way off base.

    To tell you the truth though, I haven't a clue.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •