Home > Net >  Web page elements on how to return a response?
Web page elements on how to return a response?

Time:10-06

There are ten text box, for example, set the TabIndex respectively, how to implement a carriage return after automatically jump to the next text box

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 event

CodePudding 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 element

CodePudding 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 implementation

CodePudding user response:

I'll teach them to fish the
The 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;
Document

<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>


If the outer form and submit, do you want to find a way to solve the problem of return automatically submit
  • Related