Setting values in Table without getElementsById?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Abdullah Kauchali

    Setting values in Table without getElementsById?

    Hi folks,

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

    document.getEle mentById(id).ch ildNodes[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


  • DU

    #2
    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.getEle mentById(id).ch ildNodes[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."


    [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]

    Comment

    Working...