Home > Article > Web Front-end > How to set focus on html elements
This time I will show you how to set focus on html elements. What are the precautions for setting focus on html elements. The following is a practical case, let’s take a look.
The code is as follows:
<body <form action="" method="post" name="form1" > <input type="text" id="id" /> </form> </body> <script> function myfocus() { document.getElementById('id').focus(); } </script>
I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!
Related reading:
font-weight: How to use CSS to solve the beating problem of blod
How to implement github404 dynamics in canvas
html5How to create an animation effect of a picture rotating in a circle
The above is the detailed content of How to set focus on html elements. For more information, please follow other related articles on the PHP Chinese website!