CodePudding user response:
Asp.net is not the focus, you need to use js registered client method onclientclient=onFoucs ()CodePudding user response:
Moderator say right, js register input keyup eventCodePudding user response:
Is the TAB key to jump to the next element, the return is a form is submitted, these are the default HTML ah, why do you want to return to the next elementCodePudding user response:
Document. The onkeydown=function (event) {Var e=event | | window. The event;
If (e & amp; & E.k eyCode==13) {//enter key to 13
//call the method
}
};
JQuery
The $(document). Keyup (function (event) {
If (event. The keyCode==13) {//13 is enter
//method
}
});
CodePudding user response:
Write a javascript implementationCodePudding user response:
I'll teach them to fish theThe need to use js, cannot use the.net
& lt; ! DOCTYPE html>
<meta charset="utf-8" & gt;
<meta name="viewport" content="width=device - width, initial - scale=1.0" & gt;
<meta HTTP - equiv="X - UA - Compatible" content="ie=edge" & gt;
<body>
<script>
Var tabIndex=0;
Var maxIndex=3;
Var tabKeyCode=13;
Var inputObjs=document. GetElementsByTagName (" input ");
Document. The onkeyup=function (e) {
If (e.k eyCode===tabKeyCode)
{
(tabIndex<1 | | tabIndex>=maxIndex)? TabIndex=1: tabIndex++;
for(i=0; i
Var thisTabIndex=Number (inputObjs [I] getAttribute (" TabIndex "));
If (thisTabIndex===tabIndex)
{
InputObjs [I]. Focus (); break;
}
}
}
}
</script>