Tuesday, October 27, 2009

Collapsible javascript

I believe this should work with all browsers when added to the onClick handler of what you want to trigger it. Set the div, span, etc. to have an initial display of one of the two for a fresh page load. Also I selected inline, your application may prefer block for some parts.

<script type="text/javascript">

    function ShowHide(id) {

var elementStyle=document.getElementById(id).style

    elementStyle.display = elementStyle.display ==
"inline" ? "none" : "inline";




<span onclick="ShowHide('SessionVarHider');">Session</span><span style="display:none" id="SessionVarHider"> -


  <ul id="sessionVars">

      <!--<li><a href="#">Aliquam libero</a></li>-->

      <%= SessionVariableList() %>



No comments:

Post a Comment