Home > Web Front-end > HTML Tutorial > How to set focus on html elements

How to set focus on html elements

php中世界最好的语言
Release: 2018-01-31 09:38:28
Original
3040 people have browsed it

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(&#39;id&#39;).focus(); } </script>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template