You are here: Re: href="javascript:func()" vs href="#" onclick="javascript:func()" « HTML « IT news, forums, messages
Re: href="javascript:func()" vs href="#" onclick="javascript:func()"

Posted by Dan on 10/08/02 11:50

CRON wrote:
> Cheers again Jonathan,
> But what if you don't want the link to go anywhere? If it is solely
> there to run the javascript function? Is there anything wrong with
> href="javascript:func()" ? It is simple and clean and makes more sense
> to me.
[top-posting snipped -- http://mailformat.dan.info/quoting/ ]

In many (most?) cases, the JavaScript link is there to bring up some
content in some fancy way (like in a popup box), so it would make sense
to have a valid link URL as a graceful degradation in the case of
non-JavaScript-enabled users.

Your function can end with "return false;" in order to suppress the
normal link, so it won't do something annoying like jump around in the
page when JavaScript is enabled.

--
Dan

 

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

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