Submit Form by clicking on an image

Discussion in 'ASP General' started by Ice Man, Jul 22, 2004.

  1. Ice Man

    Ice Man Guest

    Hi all

    How Can I submit a form by clicking on an image instead of the submit
    button?

    Thanks
    Ice Man, Jul 22, 2004
    #1
    1. Advertising

  2. Use JavaScript code that will submit the form as a result of the click
    event:

    <html>
    <head>

    <script type="text/javascript">
    function SubmitForm()
    {
    document.getElementById("form1").submit();
    }
    </script>

    </head>
    <body>

    <form id="form1" action="page2.htm" method="post">

    <img src="" onclick="SubmitForm()">

    </form>

    </body>


    "Ice Man" <> wrote in message
    news:%...
    > Hi all
    >
    > How Can I submit a form by clicking on an image instead of the submit
    > button?
    >
    > Thanks
    >
    >
    Elie Grouchko, Jul 22, 2004
    #2
    1. Advertising

  3. "Elie Grouchko" <> wrote in message
    news:OIAKNl%...
    > Use JavaScript code that will submit the form as a result of the click
    > event:
    >
    > <html>
    > <head>
    >
    > <script type="text/javascript">
    > function SubmitForm()
    > {
    > document.getElementById("form1").submit();
    > }
    > </script>
    >
    > </head>
    > <body>
    >
    > <form id="form1" action="page2.htm" method="post">
    >
    > <img src="" onclick="SubmitForm()">
    >
    > </form>
    >
    > </body>
    >


    Why don't you just use:

    <input type="image" src="image.jpg" alt="Submit" height="50" width="50" />

    Then the form will submit for JS user and non JS users alike.....BTW, how
    long has ASP been clientsize javascript?

    :eek:/

    >
    > "Ice Man" <> wrote in message
    > news:%...
    > > Hi all
    > >
    > > How Can I submit a form by clicking on an image instead of the submit
    > > button?
    > >
    > > Thanks
    > >
    > >

    >
    >
    Stuart Palmer, Jul 23, 2004
    #3
  4. Ice Man

    Ice Man Guest

    I don't know actually how long but it helps a lot...


    "Stuart Palmer" <> wrote in message
    news:833Mc.334$...
    >
    > "Elie Grouchko" <> wrote in message
    > news:OIAKNl%...
    > > Use JavaScript code that will submit the form as a result of the click
    > > event:
    > >
    > > <html>
    > > <head>
    > >
    > > <script type="text/javascript">
    > > function SubmitForm()
    > > {
    > > document.getElementById("form1").submit();
    > > }
    > > </script>
    > >
    > > </head>
    > > <body>
    > >
    > > <form id="form1" action="page2.htm" method="post">
    > >
    > > <img src="" onclick="SubmitForm()">
    > >
    > > </form>
    > >
    > > </body>
    > >

    >
    > Why don't you just use:
    >
    > <input type="image" src="image.jpg" alt="Submit" height="50" width="50" />
    >
    > Then the form will submit for JS user and non JS users alike.....BTW, how
    > long has ASP been clientsize javascript?
    >
    > :eek:/
    >
    > >
    > > "Ice Man" <> wrote in message
    > > news:%...
    > > > Hi all
    > > >
    > > > How Can I submit a form by clicking on an image instead of the submit
    > > > button?
    > > >
    > > > Thanks
    > > >
    > > >

    > >
    > >

    >
    >
    Ice Man, Jul 23, 2004
    #4
  5. Ice Man

    Bã§TãRÐ Guest

    The image actually works like a submit button when using

    <input type="image" name="subButton" src="image.jpg" alt="Submit"
    height="50" width="50" />

    getting the value from the submit button is
    request.form("subButton.x") OR
    request.form("subButton.y")

    Because the button is an image - you are esentially testing to see if
    the x,y value (height, width) is greater than 0

    Hope this help
    - Bastard


    On Fri, 23 Jul 2004 17:25:24 +0200, "Ice Man" <>
    wrote:

    >I don't know actually how long but it helps a lot...
    >
    >
    >"Stuart Palmer" <> wrote in message
    >news:833Mc.334$...
    >>
    >> "Elie Grouchko" <> wrote in message
    >> news:OIAKNl%...
    >> > Use JavaScript code that will submit the form as a result of the click
    >> > event:
    >> >
    >> > <html>
    >> > <head>
    >> >
    >> > <script type="text/javascript">
    >> > function SubmitForm()
    >> > {
    >> > document.getElementById("form1").submit();
    >> > }
    >> > </script>
    >> >
    >> > </head>
    >> > <body>
    >> >
    >> > <form id="form1" action="page2.htm" method="post">
    >> >
    >> > <img src="" onclick="SubmitForm()">
    >> >
    >> > </form>
    >> >
    >> > </body>
    >> >

    >>
    >> Why don't you just use:
    >>
    >> <input type="image" src="image.jpg" alt="Submit" height="50" width="50" />
    >>
    >> Then the form will submit for JS user and non JS users alike.....BTW, how
    >> long has ASP been clientsize javascript?
    >>
    >> :eek:/
    >>
    >> >
    >> > "Ice Man" <> wrote in message
    >> > news:%...
    >> > > Hi all
    >> > >
    >> > > How Can I submit a form by clicking on an image instead of the submit
    >> > > button?
    >> > >
    >> > > Thanks
    >> > >
    >> > >
    >> >
    >> >

    >>
    >>

    >
    Bã§TãRÐ, Jul 27, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    1,734
    Grant Wagner
    Dec 23, 2004
  2. Network-Man
    Replies:
    5
    Views:
    78,397
    gaul1
    Jul 7, 2012
  3. Fox
    Replies:
    2
    Views:
    270
    Randy Rahbar
    Sep 10, 2003
  4. ljlolel
    Replies:
    2
    Views:
    500
  5. Replies:
    3
    Views:
    665
Loading...

Share This Page