Jump to content

Expand / contract of tables


Guest Emma

Recommended Posts

Hi I am very new in writing html scripts, and would apprecaite any help anyone can give me.I have a big table, and I want to contract and expand a specific number of rows on the table (keeping the same amount of columns).In other words, say for ex I have a table with 3 rows and 4 columns. Now I want to (if you click on a link that says 'more') expand row nr 2 so that if you click on it it has 4 more rows (with the same nr of columns), and if you click on it again it 'dissapears' back to the original 3 row table.I did a search for this and found some nice references to expandable / collapsable MENUS, but nothing on expandalbe and collpasable TABLES/text.Any tips?Thanks

Link to comment
Share on other sites

really holme, dont spam.. Its starting to get on my nerves -.- .You need Javascript, google dynamic javascript menus or such and you can edit it that way by changing the display of it.

Link to comment
Share on other sites

Javascript part

function toggle(id) {	var obj = "";			if(document.getElementById)			obj = document.getElementById(id);		else if(document.all)			obj = document.all[id];		else if(document.layers)			obj = document.layers[id];		else			return 1;		if (!obj) {			return 1;		}		else if (obj.style) 		{						obj.style.display = ( obj.style.display != "none" ) ? "none" : "";		}		else 		{ 			obj.visibility = "show"; 		}}

html part link to display table

<a href="java script:void('0');" onClick="java script:toggle('table1');">Show table</a>

the table

<div id="table1" style="display:none"><!-- table code here --></div>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...