Mailing List Archive

id vs name attributes and javascript
While setting things up for the automated testing system, Lee made some
changes to the HTML code, adding id tags & such so the tests could find
things more easily.

I'm not sure exactly how the code should be behaving, but there does
seem to be a difference, as reported at
http://www.wikipedia.org/wiki/Wikipedia%3ANew_server_madness :

On edit pages, we've changed from:
<form .... name='editform'>
to
<form id="editform" ....>

However the latter form seems to break this JavaScript fragment in the
page's onLoad handler:

document.editform.wpTextbox1.focus()

Mozilla gives the error "document.editform has no properties".
IE 5.5 gives "'document.editform.wpTextbox1' is null or not an object".

-- brion vibber (brion @ pobox.com)
Re: id vs name attributes and javascript [ In reply to ]
> (Brion Vibber <brion@pobox.com>):
>
> However the latter form seems to break this JavaScript fragment in the
> page's onLoad handler:
>
> document.editform.wpTextbox1.focus()
>
> Mozilla gives the error "document.editform has no properties".
> IE 5.5 gives "'document.editform.wpTextbox1' is null or not an object".

The form can have both "id" and "name" if necessary. Where is that
particular piece of Javascript defined?

--
Lee Daniel Crocker <lee@piclab.com> <http://www.piclab.com/lee/>
"All inventions or works of authorship original to me, herein and past,
are placed irrevocably in the public domain, and may be used or modified
for any purpose, without permission, attribution, or notification."--LDC