Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Object Access


  • From: gassinaumasis at hotmail.com (Peter-Paul Koch)
  • Subject: [Javascript] Object Access
  • Date: Thu Apr 24 01:25:46 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