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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to hide a cell using only Javascript?

Status
Not open for further replies.

JGKWORK

IS-IT--Management
Joined
Apr 1, 2003
Messages
342
Location
GB
Hi,
I have a cell which I would like to hide with Javascript (without using CSS), I have managed this before but I keep getting the "null or not an object" error message and I have tried everything, the <td> is named "NatureCell" and its ID is the same. I have tried the following code on a Onload event and just written at the bottow of my page but neither work:


function init()
{

//document.NatureCell.style.visibility="hidden";
//NatureCell.style.display='none';
document.all.NatureCell.style.visibility="hidden";
}

I have tried several more with no luck! Thanks..
 
Use this:

Code:
document.getElementById('NatureCell').style.visibility = 'hidden';

to hide the cell. "document.all" is IE-only, AFAIK.

To remove it completely, use this:

Code:
document.getElementById('NatureCell').style.display = 'none';

Hope this helps,
Dan
 
Your a genius! Thanks alot - worked great.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top