Forum Moderators: open

Message Too Old, No Replies

need to submit form on click and on hit Enter, how?

         

fiuOY

3:47 pm on Jul 13, 2006 (gmt 0)

10+ Year Member



Hello,

I currently submit a form to a javascript function like this


<img src="images/arrowBlackWhiteBGbig.gif" width="25" height="23" border="0" onClick="calculateCost(compareForm.kwh.value);">

How can I also make it work when the user hits the Enter key

Thank you very much

penders

5:45 pm on Jul 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You could alternatively use an <input type="image" element to display your image and this will also act as the submit button for the form. That way the [Enter] button should also cause the submit action to fire, without having to code any extra events.

<form action="javascript:calculateCost(this.kwh.value);">
<input name="calccost" type="image" src="images/arrowBlackWhiteBGbig.gif" width="25" height="23" border="0" alt="Calculate Cost">
</form>