in a link onclick="someFunction(); return false;" should keep the browser from following the link?

Discussion in 'Javascript' started by Jake Barnes, Feb 15, 2006.

  1. Jake Barnes

    Jake Barnes Guest

    On this page:

    http://www.bluecasts.com/ajax/Tuesday_02_14_2006_11_18_31_PM.htm

    click in any of the main column boxes and a box full of links
    (controls) will appear. Click "Add Paragraph." The browser (IE and
    FireFox) follow the link, even though the source code says this:

    <A onclick="setText(); return false;" href="index.htm">Add
    paragraph</A>

    why would the "return false" not cancel the default behavior of the
    click? Right now the browser is following the link, but I'd prefer if
    it didn't.
     
    Jake Barnes, Feb 15, 2006
    #1
    1. Advertisements

  2. Jake Barnes

    Lee Guest

    Jake Barnes said:
    Because setText() contains a serious run-time error that prevents
    further Javascript from executing.
    "referencetoelementtobeadded has no properties"
     
    Lee, Feb 15, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.