brachole
Joined: 15 Nov 2006 Posts: 1
|
Posted: Wed Nov 15, 2006 10:01 pm Post subject: Show/Hide Script |
|
|
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> |
|
|