Submit button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gowthamkg
    New Member
    • Sep 2008
    • 23

    #1

    Submit button

    Hi,

    Can we use onclick and onsubmit function for same submit button?
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi gowthamkg,

    Yes you can. The OnClick event of the button will fire as the button is clicked and the OnSubmit event of the form will fire afterwards. Take a look at this example to see what I mean:

    Code:
    <html>
    <head>
    <script type="text/javascript">
    
    function SubmitFunction()
    {
    alert('Submitted');
    }
    
    function ClickFunction()
    {
    alert('Clicked');
    }
    </script>
    </head>
    
    <body>
    <form method="post" action="Test.asp" OnSubmit="SubmitFunction();">
    	<input type="Submit" OnClick="ClickFunction();" />
    </form>
    </body>
    </html>
    Hope this helps,

    Dr B

    Comment

    • gowthamkg
      New Member
      • Sep 2008
      • 23

      #3
      Thanx a lot..its working...

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        No problem, glad to help :-)

        Comment

        Working...