Jump to content

[SOLVED] Help 2 identify part of script


Voodoo Jai

Recommended Posts

I have found a script that I want to use but I want it tpo hide the tables row and then show it if the icon is clicked, the reverse of what it does now. I can see which part does this but dont know how to reverse it.

 

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>
Show hide row
</title>
    
<script type="text/javascript">
function poorman_toggle(id)
{
var tr = document.getElementById(id);
if (tr==null) { return; }
var bExpand = tr.style.display == '';
tr.style.display = (bExpand ? 'none' : '');
}

function poorman_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_trGrpHeader1()
{
    poorman_changeimage('trGrpHeader1_Img', 'images/toggleDLminus.gif', 'images/toggleDLplus.gif');
    poorman_toggle('trRow1');
}
</script>
    
</head>

<body>
<div align="center">
<table width="650" border="1">
<tr id="trGrpHeader1">
   <td colspan="4">
   <span onClick="javascript:Toggle_trGrpHeader1();">
   <img src="images/toggleDLminus.gif" name="trGrpHeader1_Img" width="21" height="23" id="trGrpHeader1_Img"/>Header for row 1	</span>   </td>
</tr>
<tr id="trRow1">
   <td width="150">  Hello</td>
   <td width="100" class="number">10</td>
   <td width="200" class="number">1999-11-17 00:00:00</td>
   <td width="200" class="number">1999-12-15 00:00:00</td>
</tr>
</table>
</div>
</body>
</html>

 

I think that this is the code which show or hides the rows

 

function poorman_toggle(id)
{
var tr = document.getElementById(id);
if (tr==null) { return; }
var bExpand = tr.style.display == '';
tr.style.display = (bExpand ? 'none' : '');
}

 

could someone please explain it to me.

 

Many thanks

 

VoodooJai

Link to comment
Share on other sites

just to help you a bit on your way

 

the following code

tr.style.display =  'none';

does the following

<tr style="display:none"></tr>

 

it sets the style

 

to do the reverse you could remove the style attribute

 

 

oh and one thing this function

function poorman_toggle(id)
{
   var tr = document.getElementById(id);
   if (tr==null) { return; }
   var bExpand = tr.style.display == '';
   tr.style.display = (bExpand ? 'none' : '');
}

 

the bExpand boolean has no value in the function so it will always set the style.display='none'

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.