Question:
When I press the Enter key in the username textbox, how can the focus jump to the password textbox?
Reply to discussion (solution)
<script> <br> var usernameObj = document.getElementById("username"); <br> usernameObj.onkeydown = function(event) { <br> e = event ? event :(window.event ? window.event : null); <br> // Press Enter key and the input box value is not empty <br> if(e.keyCode==13 && usernameObj.value){ <br> document.getElementById("password").focus(); <br> } <br> } <br> </script>
Statement: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