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 CRON on 10/25/67 11:50

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.

Ciaran


Jonathan N. Little wrote:

> CRON wrote:
> > Howdy!
> > I was wondering which is better to use:
> >
> > href="javascript:func()"
> >
> > OR
> >
> > href="#" onclick="javascript:func()"
> >
> > Problem is the second one, anchors to the top of the page which is very
> > messy in most cases.
> >
>
> Better to have
>
> <a href="someRealUrl" onclick="return someJavaScriptFunction()">...
>
> That way if someone has JavaScript disabled they are not left wondering
> why the link goes nowhere!
>
> --
> Take care,
>
> Jonathan
> -------------------
> LITTLE WORKS STUDIO
> http://www.LittleWorksStudio.com

 

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

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