How to submit form through an image button?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pankaj Singh

    How to submit form through an image button?

    hi,

    I want to submit a form present on an webpage through javascript. But the problem is that there is no regular html submit button, istead there is an image submit button. Moreover, while I do the
    Code:
     getElementById("myform").submit()
    nothing happens. For reference I am putting below the relvant html source of the form
    Code:
     <input name="frno" type="text"  class="TextFielsdBRDR" id="frno" onfocus="chngcode(4,'focused');" onblur="chngcode(4,'blurred');" value="Mobile No" size="11" maxlength="10" autocomplete="off"/>
     <span id="but_nonmember_sms">
    
                                <input type="image" src="../images/but_send.gif" alt="Send Free SMS" title="Send Free SMS" width="75" height="19" align="top" class="BRDRnone"/>
                                </span>&nbsp;<br />
                                <br />
    Even the onsubmit doesnot work.
    Please let me know how to submit this form through javascript. There is no id for the image submit button..
  • Cmaza
    New Member
    • May 2007
    • 16

    #2
    Needs to be document.getElementById( "myform").submi t();

    Had a similar problem in the past.

    Hope this helps. :)

    Comment

    • bushnellweb
      New Member
      • Jan 2010
      • 48

      #3
      user Cmaza is correct, assuming that the id attribute of your form is exactly "myform"

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        image submit button:
        Code:
        <button>
        	<img src="…" alt="…">
        </button>

        Comment

        Working...