td table data and the attribute name

Discussion in 'HTML' started by marcwentink@hotmail.com, Feb 8, 2006.

  1. Guest

    I am checking html against:

    http://validator.w3.org/check

    and it seems to complain about:

    <td class="stctd" name=tdbsgroep id=tdbsgroep>

    "Line 659 column 34: there is no attribute "NAME"."

    is that correct, td does not have an attribute name?

    I see this all over the place in the old code I am changing.
    (Which not necesarelly means this is correct of course.)
     
    , Feb 8, 2006
    #1
    1. Advertising

  2. Steve Pugh Guest

    wrote:
    > I am checking html against:
    >
    > http://validator.w3.org/check
    >
    > and it seems to complain about:
    >
    > <td class="stctd" name=tdbsgroep id=tdbsgroep>
    >
    > "Line 659 column 34: there is no attribute "NAME"."
    >
    > is that correct, td does not have an attribute name?


    Correct. You can check the spec yourself:
    http://www.w3.org/TR/html401/struct/tables.html#edef-TD

    > I see this all over the place in the old code I am changing.
    > (Which not necesarelly means this is correct of course.)


    Is it being used at all in your code? By some back end process (in
    which case strip it out when it's served) or by some JavaScript
    (rewrite the JS to use id or class instead)? Because otherwise it's
    just pointless bloat.

    Steve
     
    Steve Pugh, Feb 8, 2006
    #2
    1. Advertising

  3. APT Guest

    <> wrote in message
    news:...
    >I am checking html against:
    >
    > http://validator.w3.org/check
    >
    > and it seems to complain about:
    >
    > <td class="stctd" name=tdbsgroep id=tdbsgroep>
    >
    > "Line 659 column 34: there is no attribute "NAME"."
    >
    > is that correct, td does not have an attribute name?
    >
    > I see this all over the place in the old code I am changing.
    > (Which not necesarelly means this is correct of course.)
    >


    It may be confused that the "name" and "id" are the same. Both names and IDs
    should have unique names that are only used once per document.

    Try changing the ID name and see if the error is still there.
     
    APT, Feb 8, 2006
    #3
  4. Steve Pugh Guest

    APT wrote:
    > <> wrote in message
    > news:...
    > >I am checking html against:
    > >
    > > http://validator.w3.org/check
    > >
    > > and it seems to complain about:
    > >
    > > <td class="stctd" name=tdbsgroep id=tdbsgroep>
    > >
    > > "Line 659 column 34: there is no attribute "NAME"."
    > >
    > > is that correct, td does not have an attribute name?
    > >
    > > I see this all over the place in the old code I am changing.
    > > (Which not necesarelly means this is correct of course.)
    > >

    >
    > It may be confused


    No it's not confused.

    > that the "name" and "id" are the same.


    On some elements they have to be the same. On other elements they may
    or may not be the same. There is no element in HTML where name and id
    must be different.

    > Both names and IDs
    > should have unique names that are only used once per document.


    Ids must be unique within the document, but there are cases where name
    can be the repeated.

    > Try changing the ID name and see if the error is still there.


    It will be. The problem is with the name attribute itself, not with its
    value.

    Steve
     
    Steve Pugh, Feb 8, 2006
    #4
  5. Guest

    Steve:

    > Is it being used at all in your code?


    Not at all.

    The person who wrote it just assumed it should have a name and an id.
    The id is used, the name not. But why should td have an id, but not a
    name? Why is there a name and also an id attribute anyway?

    The only reason I can find is that some elements have one name, and a
    few sort of subelements, by id. And then you can use:
    getElementsByName, note the plurial "Elements".
     
    , Feb 8, 2006
    #5
  6. Steve Pugh Guest

    wrote:

    > The person who wrote it just assumed it should have a name and an id.
    > The id is used, the name not. But why should td have an id, but not a
    > name? Why is there a name and also an id attribute anyway?


    name was used in earlier versions of HTML for a selection of different
    purposes. Look at the attributes index for HTML 4 and you see that
    there are 11 different definitions for the name attribute depending on
    which element it is used on.
    http://www.w3.org/TR/html401/index/attributes.html

    So from HTML 4 onwards, the id attribute is used to uniquely identify
    an element for the purposes of scripting and linking; and the name
    attribute is only really used for form elements now.

    > The only reason I can find is that some elements have one name, and a
    > few sort of subelements, by id. And then you can use:
    > getElementsByName, note the plurial "Elements".


    Yep, radio buttons are the classic example. A group of radio must have
    the same name, but each individual radio button can have a unique id as
    well.

    Steve
     
    Steve Pugh, Feb 8, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ding feng
    Replies:
    2
    Views:
    2,853
    ding feng
    Jun 25, 2003
  2. bprimuslevy
    Replies:
    1
    Views:
    455
    Soren Kuula
    Aug 23, 2006
  3. perspolis
    Replies:
    1
    Views:
    2,614
    Mark Rae
    Jan 23, 2007
  4. Jeff Kish
    Replies:
    4
    Views:
    873
    Martin Honnen
    Oct 30, 2008
  5. Pavils Jurjans
    Replies:
    3
    Views:
    207
    Pavils Jurjans
    Mar 18, 2005
Loading...

Share This Page