Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: SV: RE: REVISITED TD HIGHLIGHTING


Message #1 by "Robert Nyman" <robert.nyman@c...> on Mon, 7 Oct 2002 20:47:49 +0200
Hi Robert and Claudio,

I think the behavior in IE6 is caused by the fact that name is not a valid

HTML 4 attribute for the <td> element. id is allowed, but name just isn't.

The fact that IE6 allows a name is implemented by a concept called expando.

AFAIK, this allows you to add your own attributes on the fly without
causing errors.

So the fact that getElementsByName returns items when they have the same id

and name is coincidence as this method returns them based on their id.
Leaving out the name attribute would cause the same behavior, if I am not
mistaken.

I haven't followed this thread completely, but can't you use
getElementsByTagName? This would return all <td> instances. Depending on
your needs, you could still add an id attribute to each <td>, or ask it's
parent (the <tr>) for certain attributes like id or classname or whatever.

Imar


At 08:47 PM 10/7/2002 +0200, you wrote:
>I have no idea, Claudio.
>
>But you can use document.getElementsByName for IE to get a collection of
>all
>the different elements, if you set the same ID on all of them
>(however, this is'nt recommended, because of the problem I described
>below with
>document.getElementById, it's not the way ID is supposed to be used).
>
>
>/Robert
>
>
>
>-----Ursprungligt meddelande-----
>Fr=E5n: Pallone, Claudio [KMR-SPC] [mailto:Claudio.Pallone@k...]
>Skickat: den 7 oktober 2002 11:45
>Till: JavaScript HowTo
>=C4mne: [javascript_howto] RE: REVISITED TD HIGHLIGHTING
>
>
>Hi Robert and thanks for your comments.
>
>You are right. The code works with Netscape 6.02 but not with IE6. So if
>I use the same id attribute for TDs I will only get a reference to the
>first one?? Why did Microsoft did that?? It is much simpler to use the
>getElementsByName!!!
>
>Cheers,
>
>Claudio



  Return to Index