Home > Article > Web Front-end > What is the usage of javascript focus
Usage of javascript focus: 1. Create an html file named focus; 2. Add style; 3. Add button and p tag; 4. Create a custom function myfocus; 5. Use the focus method Just focus on the a tag.
The operating environment of this article: Windows7 system, javascript version 1.8.5, DELL G3 computer
What is the usage of javascript focus?
How to use focus on DOM objects in JavaScript:
Create an html file named focus
Add a style, set the focus or activation style of a link to red
Add button and p tag, use the focus method after triggering the event
Create a custom function myfocus
Get the id object of a in the custom function. Use the focus method to focus the a tag
Open the file in the browser, and after clicking the button, the color of the a tag changes from blue to red
Recommended study: "javascript basic tutorial"
The above is the detailed content of What is the usage of javascript focus. For more information, please follow other related articles on the PHP Chinese website!