spacer
Yehuda Shiran November 23, 2000
Counting Attributes
Tips: November 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

Netscape boasts Netscape 6 as a much more robust browser than Internet Explorer, as far as adherence to the DOM standard is concerned. For example, the attribute count feedback in Internet Explorer is not functioning. The following link runs a little script that computes the number of attributes attached to the 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.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business