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

How to set focus on html elements

php中世界最好的语言
php中世界最好的语言Original
2018-01-31 09:38:282996browse

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>

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!

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