Revision: 4744
Updated Code
at January 18, 2008 17:37 by ecavazos
Updated Code
<script type="text/javascript"> //////////////////////////////// // prototype.js is required //////////////////////////////// var tbox = '<%= txtSearch.ClientID %>'; var sbtn = '<%= btnSearch.ClientID %>'; Event.observe(window, 'load', init, false); function init(){ Event.observe(tbox, "keypress", function(e){checkEnter(e)}); } function checkEnter(e){ if (e.keyCode == 13){ $(sbtn).click(); Event.stop(e); } } </script>
Revision: 4743
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 18, 2008 17:34 by ecavazos
Initial Code
<script type="text/javascript"> var tbox = '<%= txtSearch.ClientID %>'; var sbtn = '<%= btnSearch.ClientID %>'; Event.observe(window, 'load', init, false); function init(){ Event.observe(tbox, "keypress", function(e){checkEnter(e)}); } function checkEnter(e){ if (e.keyCode == 13){ $(sbtn).click(); Event.stop(e); } } </script>
Initial URL
Initial Description
This is to prevent a form from being inadvertently submitted.
Initial Title
Capturing The Enter Key Keypress in ASP.NET
Initial Tags
aspnet
Initial Language
JavaScript