Computing.Net > Forums > Web Development > Compact Content

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Compact Content

Reply to Message Icon

Name: zancom (by ssjgl)
Date: January 28, 2005 at 23:56:05 Pacific
OS: n/a
CPU/Ram: n/a
Comment:

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 two

I 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 two

And 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



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: January 29, 2005 at 14:35:38 Pacific
Reply:

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


0

Response Number 2
Name: zancom (by ssjgl)
Date: January 30, 2005 at 15:27:49 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


2 websites on win2k frntp... Printing webpage without ...



Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Compact Content

How do you see the contents of... www.computing.net/answers/webdevel/how-do-you-see-the-contents-of/2098.html

html table from windows dir content www.computing.net/answers/webdevel/html-table-from-windows-dir-content/1260.html

offline content www.computing.net/answers/webdevel/offline-content/1375.html