Home >Web Front-end >JS Tutorial >JavaScript gets the specified object on the current page sample code_javascript skills

JavaScript gets the specified object on the current page sample code_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:57:491346browse

How does JavaScript get the specified object on the current page. The

method is as follows:

Copy the code The code is as follows:

document.getElementById(ID) //Get the object with the specified ID value
document.getElementsByName(Name) //Get the object array with the specified Name value
document.all[] //very Smart stuff is just non-WEB standard
document.getElementsByTagName //Get the object array of the specified tag value

The example is given below. Just remove the comments and run it directly to see the effect.
Copy code The code is as follows:




New Document















< ;td width="15%" align="right">Subinventory code:




Inventory organization:








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