Reply to Re: Using id or name?

Your name:

Reply:


Posted by Jukka K. Korpela on 02/05/06 20:57

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.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация