Connecting Tech Pros Worldwide Help | Site Map

Setting values in Table without getElementsById?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 11:23 AM
Abdullah Kauchali
Guest
 
Posts: n/a
Default Setting values in Table without getElementsById?

Hi folks,

I am currently getting/setting values in an HTML table with:

document.getElementById(id).childNodes[0].nodeValue

where "id" is the id of the <td> tag of the cell.

This works, groovy.

However, I have a few <td> tags that could have the same ID's but in
different forms of the document.

How do I gain access to those "elements" if the ID's are ambiguous and I
know the name of the form? Also, what says the jury for non-unique ID's in
the same document?

many thanks in advance,

Abdullah



  #2  
Old July 23rd, 2005, 11:23 AM
DU
Guest
 
Posts: n/a
Default Re: Setting values in Table without getElementsById?

Abdullah Kauchali wrote:
[color=blue]
> Hi folks,
>
> I am currently getting/setting values in an HTML table with:
>
> document.getElementById(id).childNodes[0].nodeValue
>
> where "id" is the id of the <td> tag of the cell.
>
> This works, groovy.
>
> However, I have a few <td> tags that could have the same ID's but in
> different forms of the document.
>[/color]

"id = name [CS]
This attribute assigns a name to an element. This name must be
unique in a document."
http://www.w3.org/TR/html401/struct/global.html#adef-id

[color=blue]
> How do I gain access to those "elements" if the ID's are ambiguous and I
> know the name of the form? Also, what says the jury for non-unique ID's in
> the same document?[/color]

The jury is composed of browsers and other user agents (webtv, text
browsers, speech browsers, mobile web-aware devices, etc.) which try to
comply with W3C technical recommendations and these user agents will get
confused. Humans following strict directives of this sort would be
confused too. Maybe (assumption) W3C HTML 4.01 and DOM 1 compliant user
agents will pick the first element matching the id, stop searching and
move to the next instruction of your function.

DU
[color=blue]
>
> many thanks in advance,
>
> Abdullah
>
>[/color]
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.