Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Show/Hide Script



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
brachole



Joined: 15 Nov 2006
Posts: 1

PostPosted: Wed Nov 15, 2006 10:01 pm    Post subject: Show/Hide Script Reply with quote

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:
<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>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap