Google Groups Home Help | Sign in
Message from discussion FAQ Topic - I have <a href="javascript:somefunction()"> what ... ? (2008-05-09)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
FAQ server  
View profile
 More options May 8, 7:00 pm
Newsgroups: comp.lang.javascript
From: "FAQ server" <javascr...@dotinternet.be>
Date: Thu, 08 May 2008 23:00:01 +0000
Local: Thurs, May 8 2008 7:00 pm
Subject: FAQ Topic - I have <a href="javascript:somefunction()"> what ... ? (2008-05-09)
-----------------------------------------------------------------------
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.

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.  The sendings of these
 daily posts are proficiently hosted by http://www.pair.com.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google