Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Image rollovers in Safari 3

  1. Jul 26, 2008 #1


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Does anyone have experience with programming image rollovers that work in Safari 3? I programmed a website a while ago and everything worked fine, until Safari got updated to version 3. It seems to be a common problem, many programmers complain of this bug, but I haven't come across a solution.

    Any suggestions?
  2. jcsd
  3. Jul 26, 2008 #2
    The following code works fine in an HTML 4.01 page on IE7, Firefox 3, and Safari 3 for Windows:
    Code (Text):
    <IMG src="myimage1.png" onmouseover="this.src='myimage2.png'" onmouseout="this.src='myimage1.png'">
    The appropriate modifications allow it to work in XHTML as well. What is the code you're using?
  4. Jul 26, 2008 #3


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Thank you, I test-cased it on the Safari 3 for Mac and it works like a charm!

    The code I'm using is xhtml with css, java and php. *edit* Wouldn't it be easier to make the code in php?

    Right now I have in my navigation page:
    <img src="img/navigation_items/faq<? if($current_scriptname=="faq.php") echo "_act";?>.png">

    The menu item button "faq" will be displayed as active when someone is on the "faq" page. So if I could put in a mouseover statement in there that also echos "_act", I would be done.
    Last edited: Jul 26, 2008
  5. Jul 26, 2008 #4
    When the page is on the FAQ, you no longer need the javascript at all, so you could use something like this:
    Code (Text):

    <img src="img/navigation_items/faq<?if($current_scriptname=="faq.php") {?>_act.png" <?} else {?>.png" onmouseover="this.src='img/navigation_items/faq_act.png'" onmouseout="this.src='img/navigation_items/faq.png'"<?}?> />
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Image rollovers in Safari 3
  1. Reading in an image? (Replies: 13)

  2. Image Processing (Replies: 4)