Nick Very Senior Member
    
![[Avatar]](http://uploads.vforums.co.uk/forums/support/f_5e7b1402b305d883af97446b2fedc6c2_1-eog.jpeg) Posts: 3,013 Status: Offline Gender: Male Location: vForums Age: 35 Joined:
pmwww | Expand/collapse Table help - ASAP (20th Mar 09 at 4:32am UTC) Moved it to the correct place. | | So I am trying to make an expand/collapse tables, I got it to work so far, but it wont stay collapsed when the page is refreshed. http://fd.vforums.co.uk/
 Code: - <script type="text/javascript">
-
- var rowVisible = true;
-
- function toggleDisplay(tbl) {
- var tblRows = tbl.rows;
- for (i = 0; i < tblRows.length; i++) {
- if (tblRows[i].className != "headerRow") {
- tblRows[i].style.display = (rowVisible) ? "none" : "";
- }
- }
- rowVisible = !rowVisible;
- }
-
- </script>
-
- <table id="theTable" align="center">
- <tr class="headerRow">
- <th class="title1" width="700"></th>
- <tr>
- <td class=window2>
- <!-- BEGIN CBOX - www.cbox.ws - v001 -->
- <div id="cboxdiv" style="text-align: center; line-height: 0">
- <div><iframe frameborder="0" width="780" height="175" src="http://www5.cbox.ws/box/?boxid=367125&boxtag=7891&sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtransparency="yes" name="cboxmain" style="border:#FFFFFF 1px solid;" id="cboxmain"></iframe></div>
- <div><iframe frameborder="0" width="780" height="75" src="http://www5.cbox.ws/box/?boxid=367125&boxtag=7891&sec=form" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#FFFFFF 1px solid;border-top:0px" id="cboxform"></iframe></div>
- </div>
- <!-- END CBOX -->
- </td>
- </tr>
- </table>
-
- <input type="button" value="Open/Close cBox" onclick="toggleDisplay(document.getElementById('theTable'))" />
- </center>
-
Edit: Also if someone could clean it up as well. I'm a messy coder
Thank you
edit 2: Just realized I put this in the wrong place.. | |
|
Nick Very Senior Member
    
![[Avatar]](http://uploads.vforums.co.uk/forums/support/f_5e7b1402b305d883af97446b2fedc6c2_1-eog.jpeg) Posts: 3,013 Status: Offline Gender: Male Location: vForums Age: 35 Joined:
pmwww | Re: Expand/collapse Table help - ASAP (23rd Mar 09 at 6:37pm UTC) | | Bump? | |
|
Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Expand/collapse Table help - ASAP (24th Mar 09 at 10:28am UTC) | | For it to remain hidden, you'll have to look into the usage of 'cookies' and store the hidden status of each table! | |
|
Nick Very Senior Member
    
![[Avatar]](http://uploads.vforums.co.uk/forums/support/f_5e7b1402b305d883af97446b2fedc6c2_1-eog.jpeg) Posts: 3,013 Status: Offline Gender: Male Location: vForums Age: 35 Joined:
pmwww | Re: Expand/collapse Table help - ASAP (24th Mar 09 at 7:10pm UTC) | | Would this be it?
 Code: - function Set_Cookie( name, value, expires, path, domain, secure )
- {
- // set time in milliseconds
- var today = new Date();
- today.setTime( today.getTime() );
-
- if ( expires )
- {
- expires = expires * 1000 * 60 * 60 * 24;
- }
- var expires_date = new Date( today.getTime() + (expires) );
-
- document.cookie = name + "=" +escape( value ) +
- ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
- ( ( path ) ? ";path=" + path : "" ) +
- ( ( domain ) ? ";domain=" + domain : "" ) +
- ( ( secure ) ? ";secure" : "" );
- }
-
I'm a bit rusty with my coding, I have not coded in like 3 months. | |
|
Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Expand/collapse Table help - ASAP (25th Mar 09 at 12:30pm UTC) | | Where did you get that from? | |
|
Nick Very Senior Member
    
![[Avatar]](http://uploads.vforums.co.uk/forums/support/f_5e7b1402b305d883af97446b2fedc6c2_1-eog.jpeg) Posts: 3,013 Status: Offline Gender: Male Location: vForums Age: 35 Joined:
pmwww | Re: Expand/collapse Table help - ASAP (26th Mar 09 at 2:47am UTC) | | I actually have no clue, it was on my friends computer, and I asked if I could have the coding he has, and he said sure. Though he is more of a newb then me though.
What is the correct way to do it? | |
|