If you press the enter event in a text box to let it execute a js function, but do not want to submit the form, you can do this:
function ysearch() //Reload the DataWindow after pressing the Enter key in the year text box
{
validateInputText('yyyy');//The first js function I want to do
if(event.keyCode==13)
{
changeym();//The second js function I want to do, clear the event after completion
event.returnValue=false;//Intercept the event event, and the form will not be able to obtain event.keyCode==13
}
}
<asp:TextBox ID="txtYear" MaxLength="4" onkeydown="ysearch();"
runat="server">
</asp:TextBox>
//Tip, if you want to call two js functions in one event, such as the validateInputText('yyyy'); and changeym(); functions called in the onkeydown event, then you can write them both in one function ysearch(), and then call the total function ysearch()