Expand Div Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ismailc
    New Member
    • Sep 2006
    • 200

    Expand Div Problem

    Good day, I'm having difficulty to show the obbjects within the Div/Span

    I'm trying to create an expand & minimize effect (like tree structure) with + to expand and "-" being expanded

    Well the below works the second time around. When page Loads the "+" shows to expand but shows all the objects as it is expanded.

    But when i click on the expand icon then it works with the objects not visible & icon still being "+" and then works like it surpose to, because when i click i get the "-" expanded with objects showing below.

    Please help
    Code:
    <SCRIPT TYPE='text/javascript'>
    function toggleHistN(srcElement, srcArrow)
     {
        if (srcElement.style.display == 'none')
        {
            srcElement.style.display = '';
            srcArrow.src = 'images/expand.gif';
       } 
       else
       {
            srcElement.style.display = 'none';
            srcArrow.src = 'images/collapse.gif';
       }
    }
    </SCRIPT>
    <span id='fcHistMainN' onclick='toggleHistN(fcHistN, fcExpandN)'>
       <span>
         <img src='images/collapse.gif' id='fcExpandN' align="middle" /> App Form
       </span>
    </span>
    <tr>
      <td>
        <div id='fcHistN'>
             <table>
  • larztheloser
    New Member
    • Jan 2010
    • 86

    #2
    Rather than set the display value to nothing if it's visible, you should probably set it to something like block or inline. Not sure if that's the answer, though!

    Also some browsers may whinge that you're passing ID values directly as variables/objects, when you should be using document.getEle mentById.

    Comment

    • ismailc
      New Member
      • Sep 2006
      • 200

      #3
      Thank You :)

      The div was missing: style="display: none;

      Comment

      Working...