Jump to content

getElementById doesn't work


johnb41

Recommended Posts

I have a Dreamweaver Spry CollapsePanel which i want to open and close programatically via javascript.I can open the CollapsePanel with the ID hard coded in:CollapsiblePanel1.open(); // this works... but i need to do this programatically, and this doesn't work:var x = document.getElementById("CollapsiblePanel1");x.open(); // does not workIt's critical that i have to do it with a variable. Can anyone help?Thanks!John

Link to comment
Share on other sites

Is this "CollapsiblePanel1" an HTML element or just Javascript?
It's the ID of a DIV: <div id="CollapsiblePanel1"> <div class="CollapsiblePanelTab"></div> <div class="CollapsiblePanelContent"></div> </div> // all the magic behind this collapsepanel is done with an attached javascript file supplied by AdobeAs in the original post, if i use getElementById, and put the result into a variable, the "open" command does not work. But if i do the "open" command directly on the ID, then it does work!! What's going on?Thanks!John
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...