Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide
View Single Post
Jukka K. Korpela's Avatar
Jukka K. Korpela
Guest
n/a Posts
July 24th, 2005
12:11 AM
#4

Re: Name attribute not XHTML valid
David Dorward <dorward@yahoo.com> wrote:
[color=blue]
> Join Bytes! wrote:
>[color=green]
>> Hi. I have some code for a javascript jump menu...[/color]
>
> Leaving aside the problems with the concept of a jump menu; most
> scripts aren't very good.[/color]

The snippet that was posted illustrates many of the fundamental flaws
in the idea of using a pulldown menu instead of a link list in HTML,
the snippet even exhibits flaws that I didn't think of, such as
<option value="#">-----------------</option>
which is really awful to listen to, if you can use the "menu" on a
speech-based user agent at all.
[color=blue][color=green]
>> It validated with HTML 4.0[/color]
>
> That was obsoleted in, IIRC, 1996 with the 4.01 bug fix release.[/color]

No, it was the other way round: HTML 4.01 added the NAME attribute,
which wasn't present in HTML 4.0, and then XHTML took it away again.
The OP probably meant that the page validated under HTML 4.01.
[color=blue]
> Name is for form controls and specifies stuff for server side
> handling. You should be looking at the id attribute for client side
> stuff.[/color]

There are different ways of referring to a FORM element in client-side
code, including document.forms[0] (assuming it's the only form on a
page), which is legacy JavaScript, and document.getElementById(...),
which is modern code (and does not work on ancient browsers).
People use the NAME attribute in FORM mostly out of habit they learned
from somewhere, and that's fairly harmless if you have a page with lots
of old style code anyway - but it's pointless to try to convert such a
page into XHTML, except perhaps in a complete redesign (and even
complete redesign is better done in HTML 4.01 Strict, which can be
later converted to XHTML mechanically if needed).

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