homepage Welcome to WebmasterWorld Guest from 54.197.7.135
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / The Macintosh Webmaster
Forum Library, Charter, Moderators: travelin cat

The Macintosh Webmaster Forum

    
javascript in safari
lokem




msg:4019494
 8:28 am on Nov 5, 2009 (gmt 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>

 

Fotiman




msg:4019777
 5:19 pm on Nov 5, 2009 (gmt 0)

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.

lokem




msg:4019780
 5:26 pm on Nov 5, 2009 (gmt 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!

whoisgregg




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

onClick works everywhere. :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / The Macintosh Webmaster
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved