Fw: [Javascript] Fw: hide other divs

Steve Clay sclay at ufl.edu
Wed Apr 12 09:51:36 CDT 2006


>> The reason why you don't need getAttribute is simple the id attribute is an
>> "built in" attribute that mean that all browser will recognise
>> mydiv.attribute if you create a custom attribute like eg: <div order="1"> at
>> this point you need getAttribute to pick it up in all browser simply because
>> some browser won't recognise mydiv.order as an attribute.

Wednesday, April 12, 2006, 10:29:40 AM, Michael Borchers wrote:
> so i should not use an own attribute?! sorry, didn't wuite get the 
> solution:/ 

He's saying getAttribute is unnecessary for certain attributes, like id and
className. This is thanks to DOM1's HTMLElement interface:
http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html#ID-011100101

So instead of el.getAttribute('id'), you just need el.id

What I'm not sure of is if this interface is available for proper XHTML
docs (served as XML apps).  Anyone?

Steve
-- 
http://mrclay.org/




More information about the Javascript mailing list