rendered paste body<html><head> <title> New Document </title> <script language="javascript"> function init() { var cookie = getCookie('collapse_obj'); if(cookie) { var values = cookie.split(','); for(var i = 0; i < values.length; i++) { var itm = getItem(values[i]); if(itm) itm.style.display = 'none'; } } } function makeCookie(name, value) { var cookie = name + '=' + escape(value) + ';'; document.cookie = cookie; } function getCookie(name) { if(document.cookie == '') return false; var firstPos; var lastPos; var cookie = document.cookie; firstPos = cookie.indexOf(name); if(firstPos != -1) { firstPos += name.length + 1; lastPos = cookie.indexOf(';', firstPos); if(lastPos == -1) lastPos = cookie.length; return unescape(cookie.substring(firstPos, lastPos)); } else return false; } function getItem(id) { var itm = false; if(document.getElementById) itm = document.getElementById(id); else if(document.all) itm = document.all[id]; else if(document.layers) itm = document.layers[id]; return itm; } function toggleItem(id) { itm = getItem(id); ***************************************** if(itm == 'myTbody1') { var oldtemp = document.getElementById('myT1').innerHTML; if(oldtemp == "Collapse") { document.getElementById('myT1').innerHTML = "Expand"; } else if(oldtemp == "Expand") { document.getElementById('myT1').innerHTML = "Collapse"; } } else if(itm == whatever other myTbody's you have) make sure you add the id="myT2" "myT3" ect to your link section so javascript can recognize --------whats in your html. ***************************************** if(!itm) return false; if(itm.style.display == 'none') itm.style.display = ''; else itm.style.display = 'none'; //////////////////// cookie = getCookie('collapse_obj'); values = new Array(); newval = new Array(); add = 1; if(cookie) { values = cookie.split(','); for(var i = 0; i < values.length; i++) { if(values[i] == id) add = 0; else newval[newval.length] = values[i]; } } if(add) newval[newval.length] = id; makeCookie('collapse_obj', newval.join(',')); return false; } </script></head><body onload="init()"><table width="400"> <tbody>************************************ <tr><td style="background-color: #CCC"><a id="myT1" href="#" onclick="toggleItem('myTbody1')">Collapse</a></td></tr>************************************* </tbody> <tbody id="myTbody1"> <tr><td>Test row1</td></tr> <tr><td>Test row2</td></tr> <tr><td>Test row3</td></tr> <tr><td>Test row4</td></tr> <tr><td>Test row5</td></tr> </tbody></table><table width="400"> <tbody> <tr><td style="background-color: #CCC"><a href="#" onclick="toggleItem('myTbody2')">Expand/Collapse</a></td></tr> </tbody> <tbody id="myTbody2"> <tr><td>Test row1</td></tr> <tr><td>Test row2</td></tr> <tr><td>Test row3</td></tr> <tr><td>Test row4</td></tr> <tr><td>Test row5</td></tr> </tbody></table><table width="400"> <tbody> <tr><td style="background-color: #CCC"><a href="#" onclick="toggleItem('myTbody3')">Expand/Collapse</a></td></tr> </tbody> <tbody id="myTbody3"> <tr><td>Test row1</td></tr> <tr><td>Test row2</td></tr> <tr><td>Test row3</td></tr> <tr><td>Test row4</td></tr> <tr><td>Test row5</td></tr> </tbody></table></body></html>