Why id and name tag have to be the same ??

Discussion in 'HTML' started by Fred, Jul 17, 2003.

  1. Fred

    Fred Guest

    Maybe it's just me, but this seems a little silly....

    At the top of my page, I have a list of topics and they link to
    "bookmarks" later down the page.

    My id tags were flagged because they have to be a single token (I
    assume that means a single word ....not a phrase). So I change all of
    the id's and make sure to update all of the href="# . The next time I
    go to validate, I get slammed because the id and name tags have to be
    the same. NOTE: The name tag validates just fine when coded with
    multiple words !

    I don't understand the logic here and I'm also wondering whether, with
    certain browsers (or screen readers), this is going to cause a lot of
    repetition.

    Any comments ? What's the logic here ? (I haven't tried just coding
    one or the other...just id or just name...wonder whether that would
    have been a timesaver.)

    Fred
     
    Fred, Jul 17, 2003
    #1
    1. Advertising

  2. On Thu, 17 Jul 2003 11:38:13 -0400, Fred wrote:

    > Any comments ? What's the logic here ? (I haven't tried just coding
    > one or the other...just id or just name...wonder whether that would
    > have been a timesaver.)


    Just use id -- name isn't needed, apart from for form elements.

    --
    Toby A Inkster BSc (Hons) ARCS | mailto: | pgp:0x6A2A7D39
    aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:
    http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
    playing://(nothing)
     
    Toby A Inkster, Jul 17, 2003
    #2
    1. Advertising

  3. Fred

    Fred Guest

    On Thu, 17 Jul 2003 17:24:38 +0100, Toby A Inkster
    <> wrote:

    >On Thu, 17 Jul 2003 11:38:13 -0400, Fred wrote:
    >
    >> Any comments ? What's the logic here ? (I haven't tried just coding
    >> one or the other...just id or just name...wonder whether that would
    >> have been a timesaver.)

    >
    >Just use id -- name isn't needed, apart from for form elements.


    Excellent ! But a tad late, I'm afraid. I just went back and changed
    all of the names to match.

    Would it be better to go back and delete the name tag (e.g., being too
    "wordy") or should I just keep it now that I've done all of the
    painstaking work.

    Thanks !

    Fred
     
    Fred, Jul 17, 2003
    #3
  4. Fred

    Augustus Guest

    "Fred" <> wrote in message
    news:...
    > Maybe it's just me, but this seems a little silly....
    >
    > I don't understand the logic here and I'm also wondering whether, with
    > certain browsers (or screen readers), this is going to cause a lot of
    > repetition.
    >
    > Any comments ? What's the logic here ? (I haven't tried just coding
    > one or the other...just id or just name...wonder whether that would
    > have been a timesaver.)


    They don't have to be the same....

    Think in terms of something like a form with radio buttons... they will all
    have the same NAME because thats how radio buttons work

    But if you are using client side scripting to validate a form, you might
    have 3 radio buttons... YES, NO and OTHER... if the OTHER button is selected
    then the user has to enter something in a textbox...

    In that case, for your scripting you want the 3 radio buttons to have unique
    IDs (so you can check the OTHER one), but for the sake of the form (and how
    radio buttons work) they need to share the same NAME
     
    Augustus, Jul 17, 2003
    #4
  5. Fred

    DU Guest

    Fred wrote:
    > Maybe it's just me, but this seems a little silly....
    >
    > At the top of my page, I have a list of topics and they link to
    > "bookmarks" later down the page.
    >
    > My id tags were flagged because they have to be a single token (I
    > assume that means a single word ....not a phrase). So I change all of
    > the id's and make sure to update all of the href="# . The next time I
    > go to validate, I get slammed because the id and name tags have to be
    > the same. NOTE: The name tag validates just fine when coded with
    > multiple words !
    >
    > I don't understand the logic here and I'm also wondering whether, with
    > certain browsers (or screen readers), this is going to cause a lot of
    > repetition.
    >
    > Any comments ? What's the logic here ? (I haven't tried just coding
    > one or the other...just id or just name...wonder whether that would
    > have been a timesaver.)
    >
    > Fred


    They should not be the same for 3 reasons:
    - code readability, ease of understanding and distinguishing properties,
    values, identifiers, etc
    - debugging purposes
    - code review, examination by others

    People writing in this manner (and there are people who do this)
    <form name="form">
    <input type="text" name="text" id="text" value="text">
    ....
    var text = document.form.text.value;
    etc..

    are just asking for trouble.

    DU
    --
    Javascript and Browser bugs:
    http://www10.brinkster.com/doctorunclear/
     
    DU, Jul 18, 2003
    #5
  6. Fred

    C A Upsdell Guest

    "Fred" <> wrote in message
    news:...
    > Maybe it's just me, but this seems a little silly....
    >
    > At the top of my page, I have a list of topics and they link to
    > "bookmarks" later down the page.
    >
    > My id tags were flagged because they have to be a single token (I
    > assume that means a single word ....not a phrase). So I change all of
    > the id's and make sure to update all of the href="# . The next time I
    > go to validate, I get slammed because the id and name tags have to be
    > the same. NOTE: The name tag validates just fine when coded with
    > multiple words !


    Use of ID in anchors is required by current standards; NAME is needed for
    compatibility with ancient browsers.
     
    C A Upsdell, Jul 18, 2003
    #6
  7. Fred <> wrote:

    > Maybe it's just me, but this seems a little silly....


    It is indeed silly to multipost. See
    http://www.cs.tut.fi/~jkorpela/usenet/xpost.html

    You will just get yourself confused, when people give you wrong answers
    in different groups and the answers get just casually corrected. I
    don't think I'll bother repeating the clarifications I wrote in
    alt.html.tags, after using a crystal ball to see what your real problem
    was.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Jul 18, 2003
    #7
    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. corejavagroups
    Replies:
    6
    Views:
    3,599
    Roedy Green
    Nov 21, 2005
  2. shruds
    Replies:
    1
    Views:
    932
    John C. Bollinger
    Jan 27, 2006
  3. cppaddict
    Replies:
    6
    Views:
    350
    =?ISO-8859-15?Q?Juli=E1n?= Albo
    Jun 11, 2004
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,216
    Smokey Grindel
    Dec 2, 2006
  5. yeti
    Replies:
    22
    Views:
    2,334
    peter koch
    Feb 29, 2008
Loading...

Share This Page