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

Hidden table - Is it possible? 3

Status
Not open for further replies.

thelordoftherings

Programmer
Joined
May 16, 2004
Messages
616
Location
IL
Hello,

I would like to have a button that by clicking on it will show a hidden table and by another click will show it again. Is it possible? If yes, than how do I do it?
 
Code:
<TABLE id=myTable style="display:none;" border=1>
<tr><td>This is my Table</td></tr>
</table>

<script>
function showHide(inID){
  theObj = document.getElementById(inID)
  theDisp = theObj.style.display == "none" ? "block" : "none"
  theObj.style.display = theDisp
}
</script>

<input type=button value="Show/Hide" onClick="showHide('myTable')">

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
10X!

Can you please explain me this line:
theDisp = theObj.style.display == "none" ? "block" : "none"

 
Oh I understand now.
Different question: Where can I find all the "style" attributes? do you have a good link?
 
My favorite CSS reference page:


You can also navigate there by opening and clicking on the word 'Reference' in the left-hand menu.

This is always my first stop for all my CSS style questions. Here's the specific link you can navigate to from here on TABLEs:
--Dave
 
great post MWolf00

been trying various methods for an hour and half before I found this one that took 2 minutes to implement.

"Never underestimate the power of determination"

Stuart
Net+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top