id and name should be unique (was: RE: anchors and Bobby)

Jon Hanna wrote:

	There is no need to use the <a> element when 
	you are using id, you can put the id onto any 
	element in the content.

	If maintaining backwards compatibility I'd 
	personally prefer to use id on an element 
	surrounding the section in question, even 
	if name was  still used.

	<p id="intro">
	<a name="intro"></a>introductory paragraph.
	</p>

An attribute of type ID is supposed to be unique to the
document.  I realize that "name" and "id" are different
attributes, but realistically ... the real reason this seems 
to work is just that most browsers don't actually
enforce uniqueness.  

	<p id="intro" name="intro">text</p>

would be better, except that old browsers probably
won't see the name on anything but <a></a>.  

Perhaps it would make sense to use a convention,
such as prepending "start" to the id when 
creating the otherwise useless target anchor.

	<p id="intro"><a name="startintro"></a>
	text</p>

Then #startintro would be used when you want a
point target (as with navigation), but #intro 
would be used for actions (like CSS) that apply to 
the entire section.

-jJ

Received on Thursday, 22 January 2004 09:38:45 UTC