docs:programming:javascript:onclick_and_anchor_tags

onclick and anchor tags

To use a javascript event such as onclick with an anchor tag (“a”), you should do the following:

  • use a pound sign as the href
  • list your function call with the event, but add 'return false;' to the text
<a href="#" onclick="alert('javascript link was clicked'); return false;">JS Alert Link</a>
  • docs/programming/javascript/onclick_and_anchor_tags.txt
  • Last modified: 2008/08/03 00:25
  • by 127.0.0.1