xPersistentDisplay provides persistent display or non-display of elements with specific CSS class names.
There is an older version of this demo.
Check or uncheck the following to make the associated elements be displayed or not displayed. Your choices are saved in a cookie so the next time you visit this page those elements will automatically be displayed or not displayed based on what was saved in the cookie. The checkboxes also will be checked or unchecked accordingly.
The elements controlled by these checkboxes are displayed by default. They are in the right column of this page.
The elements controlled by these checkboxes are not displayed by default. They are in the section below the checkboxes.
The Mozilla Developer Network is an excellent resource.
References to have at your fingertips: CSS 2.1 property index, HTML 4.01 element index.
For Java projects these are indispensable: Java SE6 API spec, Java EE5 API spec.
You do not have to write any Javascript to use this object – you only have to modify a little CSS and HTML. This object expects there to be a checkbox for controlling the display of elements with a specific classname. You can have any number of checkboxes, each controlling its own group of elements.
The first checkbox must have id='xpd-chk-0'. Subsequent checkboxes must have id='xpd-chk-1', id='xpd-chk-2', etc. The checkbox with id='xpd-chk-0' will control the display of all elements that have class='xpd-ele-0'. The checkbox with id='xpd-chk-1' will control the display of all elements that have class='xpd-ele-1', etc.
The "persistent elements" can be either displayed or not displayed by default – that is, their initial state before the user has checked or unchecked any checkboxes. But we don't want the elements to be visible as the page is loading if they are to be hidden after the page has loaded. So give all "persistent elements" display:none in CSS. After the page has loaded xPersistentDisplay will read the cookie, show/hide elements as required and check/uncheck their corresponding checkboxes. If you want the "persistent elements" to be displayed by default just give the checkbox (INPUT) elements the checked attribute. View the source of this page to see how I did it in this demo. You can reload the page to see the default states.
thenLast update to this page: 22 Dec 2010
Visit the X Forums!
Peruse all X functions and objects with the X Library Viewer.
Play around with the many X Demos!
Visit some of my other sites: M Foster, Line of Light.
If you are using X, XC or anything from this site, show off your work by posting a link in the X Showcase forum.