By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,309 Members | 1,452 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,309 IT Pros & Developers. It's quick & easy.

Setting values in Table without getElementsById?

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
DU
Abdullah Kauchali wrote:
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.

"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

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?
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

many thanks in advance,

Abdullah

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.