Document. all is a proprietary attribute of IE 4.0 and later versions. It is a group of all objects in the current document, including not only object objects visible on the page, but also invisible objects, for example, html annotations. In the
① Document. getElementById sometimes misses the name, which is said to be a BUG in IE;
Http://community.csdn.net/Expert/topic/4223/4223888.xml? Temp =. 1947443.
The page contains
Program code
One is name = "category_id" and the other is id =
As follows, there is a text control with name = "txtversion:
Based on the above information, we need to use js to obtain the value in its control. We write as follows:VaR strversion = Document. getelementbyid ("txtversion"). value;The above code
Use the function flash. External. externalinterface. Call ('messagebox', "login first before play the game, please! "); To call the JS function of the ASP page. The Firefox browser can call normally. IE7 reports the following error:
Try {document.
1. Document. formname can be used to obtain the form object, but why does document. selectname fail to get the drop-down box object? Does document. All. selectname work?The formname form is a small container and a married person with children.
IE6.0GetElementsByName () and getElementById () bug
1, Document. getElementsByName (name)
Bug in IE6.0:
Returns the element whose id is equal to the given name value.
click me
baidu
Result: 4
Cause: If IE6.0
A major problem found with ASP. NET 2.0 is that getelementbyid cannot be directly used in JavaScript. The ID on the ASP page cannot be referenced directly.ASP. NET 2.0 name mangling1: UseVaR ctrlcust = Document. getelementbyid ( );2: however, if the
In the past, document. getelementbyid was often used to obtain the ID tag attribute in HTML.
Document. getelementbyname (note that there is no s) to obtain the name tag attribute. the browser reports an error. I checked the information and found
1, getElementByIdreturns the first in the same ID object, in the order in which the page appears , or null if there are no eligible objectsExampledocument.getElementById ("Id1"). Value;2, GetelementsbynameFunction: Finds an array of elements of the
Difference between document. forms [0] And getElementByName in JavaScript, getelementbyid
First, let's look at an example:
Copy codeThe Code is as follows: testtest testtest testtest
When document. forms [0] has one or more form forms in the HTML
Document. getElementById is a public standard and supported by all mainstream browsers, document. all only supports IE, document. layers is the proprietary document of Netscape4.x. all is a proprietary attribute of IE 4.0 and later versions. It is a
First declare DOM2 in Nodeiterator and treewalker these two types really just used to play, because performance does not traverse super slow, in JS basically do not use them, in addition to "elevation" there are two or three pages to explain it,
Document. getelementsbyname () obtains the control object based on the control name. Because the control name can be the same, an array of objects is returned.
Document. getelementbyid () is used to obtain the control object based on the control ID.
This is what sina's colleague xiaoniu found:
Copy codeThe Code is as follows:
The bySelector and byId functions obtain the element through querySelector and getElementById respectively.
The page contains the element "02e503e2a1c011cfc85b7b70
1. 'null' is null or not an object: Add the defer = true attribute to it,That is: 2. document. getElementById is null Cause: var titab = document. getElementById ("titletab"); no object retrievedSolution:1. Add alert (titab) under the error
Today, a friend asked me a question.
HTML of the pageCodeIs:
He wants to obtain the select value, so he writes the following code.
Document. getelementbyid ("datatime"); but it is amazing that he also gets the value of hidden input.
We couldn't
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,
GetelementbynameDoes not existOnlyGetelement _ S _ bynameAndGetelementbyid
ByidAccordingHtmlElementIDAttribute, according to specificationsIDIt should be unique and used to indicateElementFor example, ....... Therefore, the unique element handle
Town Field Poem:The Pure Heart sentiment wisdom language, does not have the world name and the benefit. Learn water under the hundred rivers, give up arrogant slow meaning.Learn to have a small return to feed root, willing to cast a conscience blog.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.