[Javascript] Object Access

Peter-Paul Koch gassinaumasis at hotmail.com
Thu Apr 24 01:25:40 CDT 2003



>oRef = document.getElementById("ElementID")
>
>is the the "approved" syntax for getting an object reference?

It's the W3C DOM way. It won't work in Version 4 and earlier browsers.

>Is it worthwhile to write/use wrapper functions like this:
>
>function getObjRef( tcObjectID ) {
>   return document.getElementById( tcObjectID )
>}
>
>oRef = getObjRef("ElementID")
>alert(oRef.value)

No. Why should you write this function? The only time that's useful is when 
you want to use several DOMs and make sure the browser uses the DOM it 
supports. See http://www.xs4all.nl/~ppk/js/index.html?dhtmloptions.html for 
an example.

--------------------------------------------------
ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
http://www.xs4all.nl/~ppk/
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
--------------------------------------------------


_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail



More information about the Javascript mailing list