[Javascript] how to refer to (x)html elements

Chris Tifer christ at saeweb.com
Wed Nov 12 12:29:43 CST 2003


----- Original Message ----- 
From: "David Lovering" <dlovering at gazos.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Wednesday, November 12, 2003 10:18 AM
Subject: Re: [Javascript] how to refer to (x)html elements


> Yes, but there are a few caveats.
>
>   var myForm = document.getElementById("form_example");
>   var myObject = myForm.getElementById("input_example");
>
> BTW -- you can't reuse an id like "example" for both an input object and a
> form, and expect things to work OK.

What do you mean by that?  Are you stating IDs should be unique?

> The caveats are that not every browser will permit you to do this (the
> getElementById call was defined originally for IE)

If this person is developing with advanced browsers in mind, there should be
absolutely no problems. getElementID is now implemented in all major
browsers as far as I know.

> , and secondly, the HTML
> object id may not necessarily map to the XML id.  I've had some problems
> with this myself, and the XML
> id only works flawlessly when it is defined within an XML construct.
> However, it SHOULD work -- providing that the object is "dual-homed" and
is
> identified with both an XML and HTML label.
>

What do you mean about an object id not mapping to an XML id?

Chris Tifer
http://emailajoke.com




More information about the Javascript mailing list