Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hidden field still takes up space in table

Status
Not open for further replies.

SuaveRick

Programmer
Apr 12, 2004
142
CA
Hello there, I have a table row that I want to hide unless there is something to put in there from our database, I'm doing that in Javascript which it not a problem. I am using the style tag with the visibility: hidden option. I also have tried visibility: collapsed (this is supposted to do what I want but it doesn't). Anyone have ideas?

My Code:
<tr bgcolor="red" style="visibility: hidden">
<td width="25%"><font size="-3" face="VERDANA,ARIAL" color="white">Tech Tools Message</font></td>
<td width="100%"><font face="VERDANA,ARIAL" size="-3" color="white">
<LABEL id=lblTechTools style="FONT-SIZE: 100%; FONT-FAMILY: Verdana,Arial">[%!ST_TECH_TOOLS%]</LABEL></font>
</td>
</tr>
 
Replace visibility:hidden with display:none. If you later want to show the invisible information, change to display:inline.

'hope that helps.

--Dave
 
You got it buddy, now I have to go and read and see why I didn't find that before :)

Thanks very much, have a great day!

Rick
 
That works but I have another problem related. When I try and show the row using javascript I get an error on the HTML line that's calling the javascript problem saying "object required". I checked the spelling and everythine else, see what you guys can find:

Where I call the function:
<input type = "button" value ="show row" onClick="showRow()">

Where I have the row:
<tr bgcolor="red" style="display: none" id=rowTechTools>
<td width="25%"><font size="-3" face="VERDANA,ARIAL" color="white">Tech Tools Message</font></td>
<td width="100%"><font face="VERDANA,ARIAL" size="-3" color="white">
<LABEL id=lblTechTools style="FONT-SIZE: 100%; FONT-FAMILY: Verdana,Arial"><a href="[%!ST_CA_PRPS%]" target="_blank">test</a></LABEL></font>
</td>
</tr>

And the Javascript function:
function showRow()
{
document.all.rowTechTools.style.display = "inline"
}

Does it matter that this row is inside a form? That's where the html for the button is as well.

Thanks for any help!
 
I haven't studied JavaScript enough to know what happens when you start referencing non-form elements (e.g., not an INPUT or SELECT or TEXTAREA) in the JavaScript (i.e., whether or not the form name is needed).

However, the line of code you gave works for me:

Code:
<html>
<head>
<script>
function showRow()
{
 document.all.rowTechTools.style.display = "inline"
}
</script>
</head>
<body>
<table>
 <tr bgcolor="red" style="display: none" id=rowTechTools>
      <td width="25%"><font size="-3" face="VERDANA,ARIAL" color="white">Tech 

Tools Message</font></td>
      <td width="100%"><font face="VERDANA,ARIAL" size="-3" color="white">
        <LABEL id=lblTechTools style="FONT-SIZE: 100%; FONT-FAMILY: 

Verdana,Arial"><a 

href="[URL unfurl="true"]https://techtools.sasknet.sk.ca/kbase/linkto.php?s...=[/URL][%!ST_CA_PRPS%]" 

target="_blank">test</a></LABEL></font>
      </td>
    </tr>
</table>
</body>

<input type = "button" value ="show row" onClick="showRow()">

</html>

However, so did it when I replaced the document.all... line with:

document.getElementById("rowTechTools").style.display = "inline";

...in the showRow() function.

'hope that helps.

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top