The button accepts three implementations of the enter event

  • 2020-03-30 03:13:46
  • OfStack

Method one:
 
<script type="text/javascript" event="onkeydown" for="document"> 
if(event.keyCode==13) 
{ 
var button=document.all("<%=ButtonAddorUpdate.ClientID %>"); 
button.focus(); 
button.click(); 
} 
</script> 

Method 2:
 
<input type="button" onclick="noClick()" style="margin-top:-1024px;" id="noUseButton" /> 
<script type="text/javascript" event="onkeydown" for="document"> 
if(event.keyCode==13) 
{ 
var button=document.getElementById("noUseButton"); 
button.focus(); 
button.onclick(); 
} 
</script> 

<script> 

function noClick() 
{ 
return false; 
} 
</script> 

Comment: makes the control invisible to the user

One: hide attributes

Two: put outside the interface

Method 3:

Block page return events
Add the following contents in the Form identification:
 
method="post" onkeydown="if(event.keyCode==13) return false;" 

Related articles: