| | | FAQ server |  |
| Posted: Thu Sep 04, 2008 9:00 pm Post subject: FAQ Topic - I have 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 document. 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.
LINK
-- 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 LINK The FAQ workers are a group of volunteers. The sendings of these daily posts are proficiently hosted by LINK |
|