MrSheen
Your last has post left me puzzled. What do you mean by "Im stuck with this function"? Further - I don't see how you went from your first <a> tag to your last. That <a> tag sort of looks like your trying to mix php and js together inside the onclick - and the quotes don't make sense (at least - not to me).
I believe what blm126 was suggesting (please forgive me if I get this wrong) was for you to change your original function to look something like this:
Code:
function showHide(inID) {
if (document.getElementById(inID).style.display == 'none') {
document.getElementById(inID).style.display = 'block';
createCookie('ShoHid'+inID,'block',1);
} else {
document.getElementById(inID).style.display = 'none';
createCookie('ShoHid'+inID,'none',1);
}
}
and then add
Code:
function do_onload() {
var vis = readCookie('ShoHid1'); // cookie for element id='1'
document.getElementById('1').style.display = vis;
}
NOTE: You will need to repeat those two lines for every ID you want to maintain
Leave the <a> tag as it was
Now a fast decision - you can either change the <body> tag to look like this
Code:
<body onload="do_onload()">
OR - add this inside your js
Code:
if (window.addEventListener) window.addEventListener("load", do_onload, false)
else if (window.attachEvent) window.attachEvent("onload", do_onload)
else if (document.getElementById) window.onload=do_onload
// Stolen from DD Contractible Header Script
All of which is assuming that your JS is either located or pulled into the head section from an external js file.
PS - This might not be an issue anymore - but some of the older browsers didn't like numerical IDs like you used in your table. Alpha/Numeric IDs are fine - as long as they starts with the Alpha part. (id="abc1234567890")
Hope this helps
Lee
Bookmarks