function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ElkeElke 

collapse pageBlockSection not working in IE

Hi all, I try to collapse a pageBlockSection using JavaScript with the method twistSection based on this: http://boards.developerforce.com/t5/Visualforce-Development/Setting-how-a-Collapsible-PageBlockSection-is-rendered/m-p/63577

Here is my very simple VF page.

<apex:page id="MyPage">
 
<script type="text/javascript"> 

 function customToggleSection(el){
  
 if(typeof twistSection == 'function'){
    var theTwist = document.getElementById(el);
   //alert (el);
   //alert (theTwist);
  
   if(theTwist){
     // twistSection expects you to click on the IMG link, this targets that img HTMLelement
     twistSection(theTwist.childNodes[0].childNodes[0])​;
     
   } 
 }
}

customToggleSection('{!$Component.MyPage.MyForm.theBlock.theSection}');

</script>
<apex:Form id="MyForm">
<apex:pageBlock mode="detail" id="theBlock">


<apex:pageBlockSection title="MySection" id="theSection" columns="1">
<!-- Section contents here -->
Text1
Text2
Text3<BR/>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:commandButton value="Click" onClick="customToggleSection('{!$Component.MyPage.MyForm.theBlock.theSection}');return false;"></apex:commandButton>
</apex:Form>



</apex:page>

The code is working fine in Firefox. But in Internet Explorer (version 8.0.7600.xxx)  I get an error on the page, to be seen in the status bar.

If I comment the line

   twistSection(theTwist.childNodes[0].childNodes[0])​;

the error disappears, but of course nothing happens…

Can anybody help me to find the reason for this? 

Thanks - Elke