|
December 25, 2000 Retrieving Objects Tips: December 2000
Yehuda Shiran, Ph.D.
|
|
The worst habit to overcome when scripting Netscape 6 is how to reference HTML objects. Internet Explorer has turned us into spoiled scripters. The following HTML tag, for example:
renders as follows:
Be sure to close this paragraph. We can reference this tag in Internet Explorer just by its ID. For example, to figure out its location we state:
This doesn't work in Netscape 6.
You cannot access objects just by their HTML ID. You need to use:
to find the object, and only then compute the object's properties. The following button calls handleClick() upon clicking:
The following works as well:
People who read this tip also read these tips: Look for similar tips by subject: |