Form submission prevention with <input type=image onclick=..>

Discussion in 'Javascript' started by Kimmo R. M. Hovi, Apr 14, 2004.

  1. Currently I have defined:

    -- clip clip --
    <form method="post" action="xx"


    <input type="image" name="Function 1" src="image1.gif" border="0"
    <input type="image" name="Function 2" src="image2.gif" border="0"

    [and so on]

    -- clip clip --

    So, it's a basic toolbar with images. Now, a need has arisen to
    make available functionality, through a clickable image, that would
    open a pop-up window (with a form, which will submit the window.opener's
    form) without submitting the original form [Until an option is selected in
    the popup].

    How exactly should I go about this? the basic <input type=image> will
    submit the form when clicked even if the onclick is defined.

    I know of the onsubmit parameter in the <form> tag, but how would I
    go about stopping the submission when this particular image is clicked?

    If it's possible to make this happen with a non-input tag, that'll be
    acceptable too.

    The "supported" browser is IE5.5+
    Kimmo R. M. Hovi, Apr 14, 2004
    1. Advertisements

  2. I'm sure I'm missing something here, but is there any reason you can't use
    <a href="..."><img src="..." ... /></a> ?

    Henk Burgstra
    Henk Burgstra, Apr 14, 2004
    1. Advertisements

  3. Or <img src="yadda.jpg" onClick="'...')"> ..?

    William Morris
    Semster, Seamlyne reProductions
    Visit our website,, for the most comfortable
    historically inspired clothing you can buy!

    William Morris, Apr 14, 2004
    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.