Welcome to WebmasterWorld Guest from 54.205.20.160

Forum Moderators: travelin cat

Message Too Old, No Replies

javascript in safari

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

5+ Year Member



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)

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



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)

5+ Year Member



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)

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



onClick works everywhere. :)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month