Welcome to WebmasterWorld Guest from 54.163.25.166

Forum Moderators: travelin cat

Message Too Old, No Replies

javascript in safari

     
8:28 am on Nov 5, 2009 (gmt 0)

New User

5+ Year Member

joined:Nov 5, 2009
posts: 2
votes: 0


Hi all!

I'm having a really frustrating problem with the simplest of javascript. It's for displaying a hidden <div> as a popup, with the help of css/javascript.
It works just the way I want it in IE, Mozilla and Opera, but when it comes to Safari, it's just a broken link. The cursor changes to the "pointer", but it's not click-able.

I can't tell how much I would appreciate your help on this one :)

The js:


function setVisible(obj)
{
obj = document.getElementById(obj);
obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
}

The html:


<a href="#" onFocus="javascript:setVisible('cssclass1',true)" onBlur="javascript:setVisible('cssclass1')">
<img src="img.png" border="0" class="shelf_prod">
</a>
5:19 pm on Nov 5, 2009 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 17, 2005
posts:4965
votes: 10


This will also not work in Chrome. The problem is that Safari and Chrome (Webkit browsers) don't support these events (focus and blur) on links. Unfortunately, I don't know of a solution.
5:26 pm on Nov 5, 2009 (gmt 0)

New User

5+ Year Member

joined:Nov 5, 2009
posts: 2
votes: 0


I was actually just thinking of that! It makes sence.. Thanks! :)

Do you know if onClick works in these browsers?

Edit:
onClick does seem to work for Safari. I have yet to try this in Chrome.
Thank you so much Fotiman!

6:09 pm on Nov 6, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Dec 9, 2003
posts:3416
votes: 0


onClick works everywhere. :)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members