Home >Web Front-end >JS Tutorial >How to use item method in javascript

How to use item method in javascript

藏色散人
藏色散人Original
2021-04-08 14:52:257690browse

How to use the item method in JavaScript: First create an html file named item; then add a button button, and add the custom function myitem to the click event; finally use the item method to obtain the corresponding node object and node name.

How to use item method in javascript

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

Create an html file named item

How to use item method in javascript

Add a button button and add a custom function to the click event myitem

How to use item method in javascript

Add a p tag and set the id to showitem

How to use item method in javascript

Create a custom function myitem

How to use item method in javascript

Get the p element object in the custom function, and use the item method to get the node object and node name whose index is 1 in the body's own point.

How to use item method in javascript

In the browser Open the file and click the button to see the effect

How to use item method in javascript

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of How to use item method in javascript. 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