JRS: In article <3f**********************@news.xs4all.nl>, seen in
news:comp.lang.javascript, Ton den Hartog <ton.den.hartog.removespam@ton
h.net> posted at Sun, 30 Nov 2003 15:25:31 :-
I am confused, when use ID and when use NAME to identify an element in HTML
?
Since ID is required to be unique within the document, whilst NAME is or
can be limited in scope, then use NAME in preference to ID when you have
the choice.
Until recently, the page on which I am currently working used a
different NAME for every element, and every element was created by a
separate piece of HTML, which was satisfactory.
Now that more of the contents are computed rather than typed in, and the
page source is 20% smaller, it is convenient to use identical NAMEs for
matching items in Form A & Form B; the form NAME distinguishes between
them as necessary.
However, ID has one advantage : an editor can easily check that an ID is
unique within a straightforward page, and an ID can be located, easily
but not efficiently, by a search over all IDs.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.