However, when using the second method to submit the form, you cannot submit the form by pressing Enter after filling in the form. This gives customers a
feeling that is different from directly using the submit button to submit the form; in order to implement this function, just add the following javascript code to your page
function butOnClick() { if (event.keyCode == 13) { var button = document.getElementById("bsubmit"); //bsubmit is the id of the botton button button.click(); return false; } }
Trigger the onkeydown event in the last input item of your form and call the butOnClick() function; for example, if the last item in the login program is a password, then
In this way, after you enter the password, press the Enter key to achieve form verification and login operations (if the username and password are correct) . This is a personal summary, please share it
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn