1. JavaScript method : Copy code The code is as follows: [javascript] <br>document.onkeydown=function(event){ <br>e = event ? event :(window.event ? window.event : null); <br>if(e.keyCode ==13){ <br>//Execution method <br>alert('Carriage return detected'); <br>} <br>} <br> <br>document.onkeydown=function(event){ <br>e = event ? event :(window.event ? window.event : null); <br>if(e.keyCode==13){ <br>// Execution method <br>alert('Carriage return detected'); <br>} <br>} <br> 2. jQuery method : Copy code The code is as follows: [javascript] <br> $(document).ready(function(){ <br>$("Control for pressing Enter").keydown(function(e){ <br>var curKey = e.which; <br>if(curKey = = 13){ <br>$("#Enter event button control").click(); <br>return false; <br>} <br>}); <br>}); <br>< /script> <br> </div>