It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Show/Hide Script

Show/Hide Script

Postby brachole on Wed Nov 15, 2006 9:01 pm

I have this script where I Show/Hide the the <div> of a table. The script works great. However, when the page loads, it shows the content with the minus sign (-).

I want it to do the opposite, where the page loads hidding the <div> with the plus sign (+).

Anyway I can tweak the script to qcheive that?

My script:



Code: Select all
<script type="text/javascript">
function overview_toggle(id)
{
   var tr = document.getElementById(id);
   if (tr==null) { return; }
   var bExpand = tr.style.display == '';
   tr.style.display = (bExpand ? 'none' : '');
}
function overview_changeimage(id, sMinus, sPlus)
{
   var img = document.getElementById(id);
   if (img!=null)
   {
       var bExpand = img.src.indexOf(sPlus) >= 0;
      if (!bExpand)
         img.src = sPlus;
      else
         img.src = sMinus;
   }
}

function Toggle_trContent()
{
    overview_changeimage('trContent_Img', 'NEWImages/MinusSign.gif', 'NEWImages/PlusSign.gif');
    overview_toggle('row1');
}

</script>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
                                      <tr id="trGrpHeader2">
                                        <td height="30" class="GeneralContentBold"><span onclick="javascript:Toggle_trContent();"><img src="NEWImages/MinusSign.gif" id="trContent_Img"/>
                                          Show/Hide Overview</span></td>
                                      </tr>
                                      <tr id="row1">
                                        <td class="GeneralContent>bla, bla, bla...
                                        </td>
                                      </tr>
                                    </table>
</body>
brachole
 
Posts: 0
Joined: Wed Nov 15, 2006 8:49 pm

Who is online

Users browsing this forum: No registered users and 4 guests