In IE and other browsers, we can use document. All. controlid to find the control whose ID is controlid. Of course, we can also use document. getelementbyid ('controlid') to find the control;
However, in netscape6 or later versions, document must be used. getelementbyid (). Otherwise, the script may fail to run normally, and hope this experience will be helpful to anyone who wants to support the Netscape control.
Supplement:
After reading using JavaScript, we found that this is related to the DOM model of the browser.
W3C DOM: Document. getelementbyid ("controlid ")
Ie4: Document. All. controlid
Netscape4: Document. layers. controlid
******************************** Updated on 2005.7.31 **** **************************
If only the name attribute is set for the control, but the ID attribute is not set, document. getelementbyid can be found, but document is used in Netscape. getelementid cannot be found. You must add an ID for this control.
Note: When registerhiddenfield of. Net registers a type = hidden input, the ID is not automatically generated, and only the name is generated. Therefore, if you want
Find this control in Netscape by searching for document. getelementsbyname ('controlid') [0 ].
Registerhiddenfield: Use response. Write to forcibly write a hidden to your page.