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

F

Fred

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
 
T

Toby A Inkster

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.
 
F

Fred

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
 
A

Augustus

Fred said:
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
 
D

DU

Fred said:
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
 
C

C A Upsdell

Fred said:
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.
 
J

Jukka K. Korpela

Fred said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top