[thelist] JavaScript: style.display

Ken Schaefer Ken at adOpenStatic.com
Wed Nov 30 04:40:09 CST 2005

Or you could have the server-side ASP for the parent page either:
a) write out some javascript to change the display state of that <tr> after
the page has loaded
b) as it dynamically generates the table, set the <tr> display state


-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Matt Warden
Sent: Wednesday, 30 November 2005 8:03 PM
To: Casey; thelist at lists.evolt.org
Subject: Re: [thelist] JavaScript: style.display

Hash: SHA1

Casey wrote:
> P.S. The app is classic ASP, but I think that won't matter as this is all a

> clientside issue.

Well, that's part of your problem. A fully client-side solution probably
isn't best. However, you could do this fully client-side by saving the
state in cookies. Maybe a series of bits (or the hexidecimal
representation if you're worried about the cookie filesize limitation).



Then you would reconstruct the state onload setting all tr's to
display='none' where its respective bit is 0 and display='' where its
respective bit is 1.

Something like (pardon me if I intermingle JavaScript and Java syntax --
but this is the general idea):

// where mycookie is a string with the value of tableState cookie above
var trs = document.getElementById('mytable').getElementsByTagName('tr');
for (var i=0; i<trs.length; i++) {
    if (mycookie.charAt(i)=='0') {
        trs[i].style.display = 'none';
    else {
        trs[i].style.display = '';

- --
Matt Warden

More information about the thelist mailing list