|
-
Jan 21st, 2004, 04:52 AM
#1
Thread Starter
Lively Member
Reference an object
Hi
Can anyone help me with something that is confusing me...
I know that in javascript you can reference a HTML object by using:
document.all['blah'] etc
but it i want to dynamically reference the object for example
var strValue = 'divInfo';
document.all[strValue]
I am unable to do this
Can anyone suggest why this might be the case?
Thanks in advance
Sarah
-
Jan 21st, 2004, 11:45 AM
#2
It should work. Are you sure the element exists?
But document.all is IE-only!
document.getElementById(<id>) is better.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 22nd, 2004, 07:33 AM
#3
Frenzied Member
yes, use getElementById(). if it still esn't working, please tell us what the rror is and what browser you get the error with?
Have I helped you? Please Rate my posts. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|