Home > Web Front-end > JS Tutorial > Analysis of the difference between Document and Document.all_javascript skills

Analysis of the difference between Document and Document.all_javascript skills

WBOY
Release: 2016-05-16 18:58:20
Original
1111 people have browsed it

[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh it to execute ]

If with a, form object , the name attribute is set in the html tag corresponding to the image object and applet object. Its value will be used as the attribute name of the document object to refer to the corresponding object, but other objects cannot.
In addition, if input is used as a sub-element of form, it is wrong to directly use inputName or document.inputName to reference this object. You must use formName.inputName to reference, otherwise you can use inputName to reference.
In addition, you should Notice that there are many commonly used elements without names.
If you want to refer to an element with an id, you can only use Id or document.getElementById, document.all.id to refer to
. But for elements like this, so
like ...... can be used
linkid.href ;
linkname.href;
document.all.linkid.href;
document.all.linkname.href;
document.getElementById("linkid").href;
document.getElementsByName ("linkname")[0].href
to reference
all is a collection that contains all html objects. Write a program that can access all objects. Like this:
Copy code The code is as follows:


Be sure to put the program after .
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