November 23, 2000 - Counting Attributes
November 23, 2000 Counting Attributes Tips: November 2000
Yehuda Shiran, Ph.D.
|
BODY
element of this tip. Here is the script:
<SCRIPT LANGUAGE="JavaScript">
<!--
function computeAttributes() {
var objBody = document.getElementsByTagName('BODY').item(0);
var countAttr = objBody.attributes.length;
alert(countAttr);
}
-->
</SCRIPT>
Click the link above. If you are running Internet Explorer V5, you will get the amazing 94. If you are running Netscape 6, you should get 4, as the BODY
element looks like this in this tip:
<BODY TEXT="#000000" LINK="#000099" VLINK="#000066" ALINK="#990000">
In fact, Internet Explorer computes a different number for every element type. 94 for BODY
, 75 for HTML
, 77 for P
, and so on.