Tag: getelementbyid Getelementsbyname Getelementsbytagname
Getelementbyid:
Syntax: Document. getelementbyidx (ID)
Parameter: ID: Required string)
Returned value: object;
Returns the first object with the same ID. If no matching object exists, null is returned.
Example:Document. getelementbyidx ("id1"). value;
Getelementsbyname:
Syntax: Document. getelementsbyname (name)
Parameter: Name: Required string)
Returned value: An array object. If no matching object exists, an empty array is returned.
Example:
Document. getelementsbyname ("name1") [0]. value;
Document. getelementsbyname ("name1") [1]. value;
Getelementsbytagname:
Syntax: object. getelementsbytagname_r (tagname) object can be document or event. srcelement. parentelement.
Parameter: tagname: Required string (string)
Returned value: An array object. If no matching object exists, an empty array is returned.
Example:
Document. getelementsbytagname_r ("p") [0]. childnodes [0]. nodevalue;
Document. getelementsbytagname_r ("p") [1]. childnodes [0]. nodevalue;
From: http://blog.sina.com.cn/s/blog_41630ab301008s82.html