|
Posted by John Salerno on 02/06/06 00:05
Jukka K. Korpela wrote:
> John Salerno <johnjsal@NOSPAMgmail.com> wrote:
>
>> If you're writing strict HTML 4.01, should you still use both the
>> id and name attribute, or is name good enough?
>
> The id and name attributes each have their own jobs, and the job varies
> especially as regards to the name attribute.
>
> You use id to assign a unique (within a document) identifier to an
> element. You use name to assign a name to a form field for the
> purposes of form submission (id won't do that), and maybe for some
> other purposes as well, for some elements.
>
>> I know name is deprecated in XHTML,
>
> It isn't. For form fields in particular, it is a necessity. It is
> deprecated in _some_ contexts, see
> http://www.w3.org/TR/html/#h-4.10
> (The heading there is misleading and part of the confusion:
> "The elements with 'id' and 'name' attributes". Surely an <input>
> element may have such attributes, and the name attribute is _not_
> deprecated there, and the use of id does _not_ replace name there.)
>
> In setting up a link destination, it is rather safe nowadays to use
> just the id attribute, in a suitable element. Browsers that only
> recognize <a name="..."> destinations have become rare.
>
Ok, so in the case of creating an image map, using just id is okay?
Navigation:
[Reply to this message]
|