In my application i have taken a submit button in my html form but it gets submitted when the button is CLICKED that is i have kept a onClick event on that button & the type of button is "button" not "submit" because if i keep it as submit then some problem arises in my application thats when i click on that button using mouse the form gets submitted 2 times.
So what i want to do is i want to keep this onclick event active but if the user presses enter key then also the function called on onClick event should get called..
So how to do this thing??
The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Though I partially understood you question, you can use onsubmit event handler of the form tag.
You need to use the "submit" button and you need to write the function to handle the onsubmit event of the form. So in both the cases (click of submit button or enter key) will trapped. On the event handler, if you dont want the form to get submitted, you can return false from the event handler.
Hope this helps.
Where does a nanny get ground to air missles? Protect this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop