collapse tables?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
mabufo
Forum Commoner
Posts: 81
Joined: Thu Jul 10, 2003 11:11 pm
Location: Orland Park, IL
Contact:

collapse tables?

Post by mabufo »

I was looking around a website that I go to a lot; and noticed that they had an option to 'collapse' a table with a shoutbox in it. I clicked, the page refreshed, and BAM, table's gone. (the site is bohegeha.com) then a little thing appears that says view-and if you click that; the shoutbox reappears.


I would like to do this for my website... does anyone know how?
newton
Forum Newbie
Posts: 3
Joined: Fri Aug 15, 2003 2:01 pm
Location: Montreal, Quebec
Contact:

Post by newton »

All you have to do is add

Code: Select all

style="display:none;"
into the TABLE tag to make it disapear. (It wont hold the space either - in compatible browser that is) And remove it from the tag to show the said table.

for more info on this, check out http://www.w3schools.com/css/pr_class_display.asp
Bongulim
Forum Newbie
Posts: 21
Joined: Thu Aug 07, 2003 12:50 pm

Re: collapse tables?

Post by Bongulim »

mabufo wrote:I was looking around a website that I go to a lot; and noticed that they had an option to 'collapse' a table with a shoutbox in it. I clicked, the page refreshed, and BAM, table's gone. (the site is bohegeha.com) then a little thing appears that says view-and if you click that; the shoutbox reappears.


I would like to do this for my website... does anyone know how?
The always correct answer: look how they do it, and copy!
junrey
Forum Newbie
Posts: 12
Joined: Thu May 09, 2002 9:53 pm
Location: Cebu, Philippines
Contact:

Re: collapse tables?

Post by junrey »

hello,
mabufo wrote:I was looking around a website that I go to a lot; and noticed that they had an option to 'collapse' a table with a shoutbox in it. I clicked, the page refreshed, and BAM, table's gone. (the site is bohegeha.com) then a little thing appears that says view-and if you click that; the shoutbox reappears.


I would like to do this for my website... does anyone know how?
its just a matter of condition. You can do that by having variables in session or cookies or through get method. you can pass values and try to test what you wanted to happen. Try this idea, this is using the get method:

Code: Select all

<?php

if ($_GET['show']==1) {
   echo "This is shown.";
   echo '<a href="?show=2">Hide</a>';
} else {
   echo "This is hidden.";
   echo '<a href="?show=1">Show</a>';
}

?>
the code try to display one of them. There are also some other ways in doing so, using Javascript.

Code: Select all

<?php
<html>
<head><title></title></head>
<body>
<script language="Javascript">
	function showHide(theID) {
   	doc = document.getElementById(theID);
   	if (doc.style.display=="") {
   		doc.style.display = "none";
   		doc.value = "Show";
   	} else
   		doc.style.display = "";
   		doc.value = "hide";
   	}
	}
</script>
<input type="button" id="theButton" value="Show" onClick="showHide('menu');">
<div id="menu" style="background-color: green">
The menu will go here<br />
The menu will go here<br />
The menu will go here<br />
The menu will go here<br />
The menu will go here<br />
The menu will go here<br />
The menu will go here<br />
The menu will go here<br />
The menu will go here<br />
</div>
</body>
</html>
?>
i hope, these help.

Regards.
will
Forum Contributor
Posts: 120
Joined: Fri Jun 21, 2002 9:38 am
Location: Memphis, TN

Post by will »

well yes you could do it with PHP and send everything back to the server, but what they were talking about in the previous posts makes much more sense... use CSS and javascript. give the table an ID, then the link would be something along the lines of "javascript:document.disappearingTable.style='display: none;'" you'd need a little more to have the same link toggle the display status, but as they said - just view the source and see how they did it.
Post Reply