Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I need some kind of script that will allow me to have different sections on one page and have the different sections to be able to be compacted or minimized by the viewers. Kinda like the way that you can minimize a window in your OS. Not sure if that makes much sence so ill TRY to say it another way.
Section One.................X
Content here for section one
Section Two.................X
Content here for section twoI want so that you can click the "x" on section one to cause it to "hide", so then it would look like this:
Section One.................X
Section Two.................X
Content here for section twoAnd then you could click the "x" again to show section one again.
If any of you guys know of a script that can do this then please tell me! Appreciate it, and thanks.
http://www.iblob.info
http://www.infoshackdesigns.com

I am assuming that you have some basic knowledge of JavaScript and CSS. If not, you might have to do some studying on those languages.
You will want to assign the content for each section an id. You can do this in a span or div tag if the content is not already within some kind of tag such as a cell or table. Example:
Section 1 (X) - more about the X later
<div id=section1>Here is the content for section 1</div>Then the X's need to link to a JavaScript function and pass the section identifier to the fuction, such as : [a href="" onClick="sectionChange(section1);"]X[/a]
(Sorry couldn't escape the less than sign in the link above for some reason, just replace the brackets with the less than/greater than signs)
The JavaScript function will then check to see if the section is currently hidden or not and do the opposite, like this:
<Script Language="Javascript">
function sectionChange (section) {
// create a variable for the section element
section = document.getElementById (section);// See if the section is currently hidden
if (section.style.display=='none') {//Show the section
section.style.display = 'inline';} else {
//Hide the section
section.style.display = 'none';
}
}
</script>Michael J

Thank you very much for that. Glad to know that you understood what I was talking about :)
http://www.iblob.info
http://www.infoshackdesigns.com

![]() |
2 websites on win2k frntp...
|
Printing webpage without ...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |