Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 16:57:49
Original
1307 people have browsed it

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:








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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!