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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint