|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Dynamic Referencing
Can I dynamically reference objects, like:
IE datavar = 'datasource'; dataobj = 'document.all.' + datavar NS datavar = 'datasource'; dataobj = document.getElementByID(datavar)
__________________
Beginner |
|
#2
|
||||
|
||||
|
yup - no problems!
Check out the excellent eval() function - i use it all the time. datavar = "datasource"; dataobj = eval('document.all.' + datavar) Tho i think getElementById() is avail on all v5+ browsers? |
|
#3
|
|||
|
|||
|
You're right Stumpy, you can use getElementById in IE 5+. It works exactly the same as NS and allows you to return the first occurrence of an element with the ID attribute specified.
--Andi |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Dynamic Referencing |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|