Page Organizer 2 | JavaScriptSource

Page Organizer 2

Chris Armstrong May 18, 2005

General

Use JavaScript and CSS to hide/show elements on a page thus saving screen space.


Click here for information ...

Click here for more information ...

Click here for still more information ...

Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: pageOrganizer.js


CSS

Paste this code into your external CSS file or in the <style> section within the HEAD section of your HTML document.


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


Leave a Response

(3 comments)

Just remove (my_sub.style.display = "none";) from the external js file

GL Oct 31, 2008

Do you have the correct path to the external file? If so, due to the limitations of these comments, you will need to submit your question to the [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]JavaScript Forum[/a] for further help.

Lee Underwood Jan 29, 2008

I love this script, but I can not get it to work an external file. I created the file and saved it as "pageOrganizer.js" and in the file I have var subs_array = new Array("sub1","sub2","sub3");// Put the id's of your hidden divs in this array[br /][br /]function displaySubs(the_sub){[br /]&#9; if (document.getElementById(the_sub).style.display==""){[br /]&#9; document.getElementById(the_sub).style.display = "none";return[br /] }[br /] for (i=0;i<subs_array.length;i++){[br /]&#9; var my_sub = document.getElementById(subs_array&#91;i&#93;);[br /]&#9; my_sub.style.display = "none";[br /]&#9; }[br /] document.getElementById(the_sub).style.display = "";[br /]}[br /] but it always errors out. To test the code I pasted it into my html and it works. Checked my path and name of the file and it doesn't work. I even checked viewed the source of this page a found that the js was also pasted into the html and did not refer to and external js file?[br /][br /]Any idea's?

Bj Fulmer Dec 9, 2007