Website Administered by: Michael Falatine (remove "1" from end when emailing)
Released: 12/27/2004
Additional Version (ICON ON LEFT SIDE)
(12/16/2006) Left Side Version (click me): Modifed code and HTML to have icon on left instead of right.

Right Side Version download is at bottom of page.
Basic Description:
Script allows developers to easily embed an expandable/collapsible "content area" (table based) into a webpage that allows visitors a quick way to hide unwanted content from display.
Features List:
  • Internet Explorer BrowserIE 5.5+ ONLY
  • No code is required to be within table elements or DIV container
  • Tables within tables are supported, however, see below for limitations
  • Supports elements inside "content" cell such as <span>

Note: If you require the content areas to be expanded on initial loading of page INSTEAD of collapsed then change this line in the .js file:

var GlobalECState=1 // 0=collapsed, 1=expanded; used for initial state of ALL branches

Make the variable GlobalECState  0.
 

Demonstration of Code:
Example of one table inside another
Example of simple layout
Content Here

Example of simple layout
Content Here

Table unaffected by script because it is outside of container DIV
     
Code considerations:
  • Installation:
    • ALL Tables that you wish to have this feature must be wrapped by a SINGLE DIV
      Example:

      <DIV CONTAINER>
        <TABLE with FEATURE><ANOTHER TABLE with FEATURE></TABLE></TABLE>
        <ANOTHER TABLE with FEATURE></TABLE>
      </DIV>

      <TABLE without FEATURE></TABLE>
       
    • Layout of Table with feature:
      • Must have a header row "<TR><TH></TH></TR>"
      • Can only have one row after header "<TR><TD>content area</TD></TR>"
    • SINGLE DIV (id is set to "container") is set to be first on the page
      • To change location of this DIV set line 26 from 0 (the first DIV) to reflect the location of the DIV:
        document.getElementsByTagName("DIV")[0].setAttribute("id", "Container");
      • For example, if you have multiple DIV's on the page and the location of this feature is the 4 DIV on the page then line 26 would be:
        document.getElementsByTagName("DIV")[3].setAttribute("id", "Container");
      • Note: On this page the above line is set to 6 because it is the seventh DIV on the page
        (Wow, I seem to like DIV's!)
  • Limitations & Known issues:
    • Tables can NOT go inside the "content" area of a table with this feature UNLESS the inside table is setup to contain the feature itself.
    • Source code is commented but not heavily
Get the Code:
Download the .zip file containing everything here (including +/- images made by 4thorder(TM))
Top of Page

Valid HTML 4.01!

Views: 12831

Valid CSS!