Window.onload =function () { //prevent problems with submitting forms after you press the Enter buttondocument.getElementsByTagName ("form") [0].onkeydown =function () { if(Event.keycode = = 13) {return false; } }; varInputs = document.getElementsByTagName ("Input"); varindex = 1; for(vari = 0; i < inputs.length; i++) { if(Inputs[i].type = = "text" && inputs[i].style.display! = "None" && inputs[i].getattribute ("disabled")! = "Disabled") { //Set the TabIndex order value to a text box that is not hidden on the page, and then jump in TabIndex order belowInputs[i].setattribute ("TabIndex", index); //Listen for onkeydown events, enter the input when the implementation jumps to the next text boxInputs[i].onkeydown =Gonextinput; Index++; } }};functionGonextinput () {if(Window.event.keyCode = = 13) {//Enter the input when the next entry box jump //the TabIndex value of the next entry box varNextindex = parseint (Window.event.srcElement.getAttribute ("TabIndex")) + 1; varInputs = document.getElementsByTagName ("Input"); for(vari = 0; i < inputs.length; i++) { if(Inputs[i].type = = "text" && inputs[i].style.display! = "None") { varTabIndex = Inputs[i].getattribute ("TabIndex"); if(TabIndex! =NULL) { varindex =parseint (TabIndex); if(typeofindex = = "Number" &&!isnan (index) && index = =Nextindex) {Inputs[i].focus (); } } } } }}
HTML page Implementation carriage return jump next text box