W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2000

RE: setAttribute

From: Rob Relyea <rrelyea@microsoft.com>
Date: Fri, 15 Dec 2000 17:39:18 -0800
Message-ID: <DD62C16D92CF434CA50283B8E11F3A3FA05467@red-msg-06.redmond.corp.microsoft.com>
To: "'Peter Benoit'" <pbenoit@triton-network.com>, www-dom@w3.org
Since version 4.0 of IE, our getAttribute() implementation has been focused
on OM properties, not the actual html attributes.

So, here are the ways to set a class:

.bar {color:green}
.foo {color:red}

<div class=foo id=d1>my div</div>
divEl = document.getElementById("d1");

//this works in nav6 and ie4 and later
divEl.className = "bar";

//this works in nav6 but not ie

//this works in ie but not nav6

We can consider fixing this in the future, however, most web authors
probably want to use divEl.className until then since it has worked since
IE4 and also works in Nav6.

thx, rob
lead program manager, ie programmability

-----Original Message-----
From: Peter Benoit [mailto:pbenoit@triton-network.com]
Sent: Thursday, December 14, 2000 11:42 AM
To: www-dom@w3.org
Subject: setAttribute

It seems that Internet Explorer and Netscape have wildly different ways of
using this method.  I would like to know which is correct... or at least
more correct.

As an example, in IE you would set an attribute as such:


but in Netscape you would do something like:


It appears that Netscape works of the string and applies the matching
attribute, whereas Internet Explorer looks for a matching JS method??

I'm confused, please help.  :)

Received on Friday, 15 December 2000 21:40:46 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:07 UTC