Document. getelementbyid ("") is an object, which is displayed with alert as "object" rather than a specific value. It has attributes such as value and length, plus. the value is the specific value!
References:
1. Usage of document. getelementbyid and DHTML. CHM
Find the usage of document. getelementbyid on the network today, as follows:
A: Syntax:
Oelement = Document. getelementbyid (SID)
Parameters:
Sid: required. String ).
Return Value:
Oelement: Object (element ).
Note:
Obtains an object based on the specified ID attribute value. Returns the reference of the first object whose ID property value is equal to Sid. If the corresponding object is a group of objects, the first object in the group is returned.
If no matching object exists, null is returned.
B: An example is as follows:
**************************************** ************************************
**
* The most important part of this function is document. getelementbyid. What is it? *
**
* For document. getelementbyid, this is the case :*
**
* For example, document. getelementbyid ('hdrpageheader _ lbltitle ')*
**
* Indicates that the object whose ID is hdrpageheader_lbltitle is obtained *
**
* <A> AA </a> *
* <A> BB </a> *
* <A> CC </a> *
* <Script language = "JavaScript"> *
* <! --*
* Var idtext = Document. getelementbyid ('hdrpageheader _ lbltitle ')*
* Alert (idtext. innertext )*
* // --> *
* </SCRIPT> *
C: You can also get the following details:
① Document. getelementbyid sometimes misses the name, which is said to be a bug in IE;
The page contains
<Input type = "hidden" value = "2"/>
<SELECT>
One is the other is
Use document. getelementbyid to obtain the second one. However, the first one is obtained.>
In IE, getelementbyid does not capture the ID first, but first finds the object with the same name...
Two forms. Each form has two textbox. the textbox in the two forms has the same name, but the IDs are different...
So there is no problem in Firefox.
2. Document Object
Http://www.phpx.com/man/dhtmlcn/objects/obj_document.html
Attribute: title; bgcolor; Url; (Use: Document. Title)
Method:
Focus
So that the element gets the focus and executesCode.
Getelementbyid
Obtains the reference of the first object whose ID label attribute is the specified value.
Getelementsbyname
Obtains the object set based on the value of the name tag attribute.
Getelementsbytagname
Obtains an object set based on the specified element name.
Method:
Focus
So that the element gets the focus and executes the code specified by the onfocus event.
Getelementbyid
Obtains the reference of the first object whose ID label attribute is the specified value.
Getelementsbyname
Obtains the object set based on the value of the name tag attribute.
Getelementsbytagname
Obtains an object set based on the specified element name.
Trackback: http://tb.blog.csdn.net/TrackBack.aspx? Postid = 1897389