Connecting Tech Pros Worldwide Help | Site Map

FAQ Topic - I have <a href="javascript:somefunction()"> what ... ?

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 1st, 2007, 11:15 PM
FAQ server
Guest
 
Posts: n/a
Default FAQ Topic - I have <a href="javascript:somefunction()"> what ... ?

-----------------------------------------------------------------------
FAQ Topic - I have <a href="javascript:somefunction()"what
.... ?
-----------------------------------------------------------------------

Whatever the rest of your question, this is generally a very bad
use of the javascript pseudo protocol. It was designed so that a
function could return a new page. For example:
` javascript:"<p>Hello</p>" `.
Using it simply to call a function when a link is clicked causes
an error in user agents that do not support javascript, or have
javascript disabled. Instead, use
` <a href="something.html" onclick="somefunction();return false"`
where something.html is a meaningful alternative. Alternatively,
place the onclick event on another element so that users without
JavaScript aren't even aware that it does anything.

http://www.useit.com/alertbox/20021223.html


===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.