How to capture enter key pressed in a form (JavaScript) - Barattalo Here is the javascript function ...

Please Visit: http://ift.tt/1ajReyV



How to capture enter key pressed in a form (JavaScript) - Barattalo

Here is the javascript function that handle the event:

? (Link->http://ift.tt/1katoOQ) 010203040506070809101112<script type="text/javascript"> function submitonenter(formid,evt,thisObj) { evt = (evt) ? evt : ((window.event) ? window.event : "") if (evt) { // process event here if ( evt.keyCode==13 || evt.which==13 ) { thisObj.blur(); document.getElementById(formid).submit(); } } }</script>

This is the html form with the “onkeypress” listener:

? (Link->http://ift.tt/1katoOQ) 12345<form id='formlogin' action='file.php' method='post'> <input type='text' name='username' /> <input name='pass' type='password' onkeypress="submitonenter('formlogin',event,this)" /> <input type='submit' value='login'/></form>

http://ift.tt/1katoOQ

http://ift.tt/1katmpX



How to capture enter key pressed in a form (JavaScript) - Barattalo







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1sCYZcz

via LifeLong Community

No comments:

Post a Comment