How can I fix image rollovers in Safari 3?

  • Thread starter Thread starter Monique
  • Start date Start date
  • Tags Tags
    Image
Click For Summary

Discussion Overview

The discussion revolves around programming image rollovers that function correctly in Safari 3, particularly in the context of web development. Participants share their experiences and code snippets to address issues arising from a Safari update.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant notes a common problem with image rollovers in Safari 3 and seeks solutions.
  • Another participant shares a code snippet that works in multiple browsers, including Safari 3 for Windows, and asks for the original code used by the first participant.
  • A third participant reports successful testing of their code in Safari 3 for Mac and suggests that using PHP might simplify the rollover implementation.
  • A later reply proposes a conditional approach to the rollover that eliminates the need for JavaScript when the FAQ page is active, integrating PHP into the image source logic.

Areas of Agreement / Disagreement

Participants express varying experiences with image rollover functionality in Safari 3, with some solutions working for certain setups while others remain unresolved. There is no consensus on a single solution applicable to all scenarios.

Contextual Notes

Limitations include potential differences in behavior between Safari versions and platforms (Mac vs. Windows), as well as the reliance on specific coding practices (HTML vs. XHTML, JavaScript vs. PHP).

Monique
Staff Emeritus
Science Advisor
Gold Member
Messages
4,229
Reaction score
61
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?
 
Technology news on Phys.org
The following code works fine in an HTML 4.01 page on IE7, Firefox 3, and Safari 3 for Windows:
Code:
<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?
 
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:
When the page is on the FAQ, you no longer need the javascript at all, so you could use something like this:
Code:
<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'"<?}?> />
 

Similar threads

Replies
8
Views
6K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 131 ·
5
Replies
131
Views
26K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
Replies
15
Views
11K