You are here: Re: link hover color not honored when using onclick event « HTML « IT news, forums, messages
Re: link hover color not honored when using onclick event

Posted by Mitja Trampus on 09/26/11 11:33

Richard Thoms wrote:
> Mark Parnell wrote:
>
>> In our last episode, Richard Thoms <rdthoms@bellsouth.net> pronounced to
>> alt.html:
>>
>>> The second link has no href in it (is that legal?)
>>> /.../ [:hover does not work]
>> That's because without a href attribute it's not a link. It's just an
>> anchor.
>
> I think this is the key to the problem. No href means no link, just an
> anchor. I develop using firefox and everthing looked great there but
> then when I test with IE I got unexpected results. Perhaps it is
> firefox which has a bug and is letting this sneak through.

Nono, check the specs, it's IE that's rusty.
The solution to your problem is to use something along the
lines of
<a
href="foo.html"
onclick="window.open('foo.html'); return false"
>
instead of just
<a onclick="window.open('foo.html')">

This solves your problem (a is now a "proper" link and IE
will support :hover on it) as well as another one: your
current solution does not work for users without JS, whereas
the one with href does.

WRT popup-blockers: No, they're smart enough not to block
popups triggered by onclick events, so I wouldn't worry
about that.
What I'd consider more is whether a popup is perhaps still
more of a nuisance to the user than an elegant solution.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация