The method I found on the Internet is
This way It does work in IE, but it doesn't work in Google or Firefox. After entering a line, click Enter and submit it directly. How to do it? grateful!
You should write JS separately
How to do it specifically
onkeydown event and obj.focus( );
Personal test results
onkeydown="if(event.keyCode==13){event.keyCode=9; alert(event.keyCode);}"
IE outputs 9
Firefox outputs 13, no change at all. .
What’s the principle. . Awaiting consultation. . I checked a lot of information and still can't figure it out.
As for how to implement your question:
As mentioned above, the onkeydown event and obj.focus();
1. Judge the enter key in the onkeydown event of the form Shield the onsubmit event,
2. In the onkeydown of the input element, the cursor points to the next input element (because it is similar to event.keyCode=9, the method of using code to implement tab operation... You have also seen that the compatibility is not strong . . )
Use a function
function x() {
var e = arguments[0] || window.event;
if(e.keyCode==13 )e.keyCode=9;
}
Then write the html like this