Maelstorm Posted May 13, 2009 Posted May 13, 2009 Consider the following code:<html><head><title>Test</title><script language="JavaScript" type="text/javascript" application="yes">var idData = "item";</head><body><span id="item"></span></body></html>How do you access, say item.innerHTML by referencing idData? I tried using idData.innerHTML but the interpreter throws an error. Any ideas?
jcarle Posted August 1, 2009 Posted August 1, 2009 document.getElementById(idData).innerHTML will do the trick.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now