473,396 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

hidding and showing text

hello, i never studied javascript (i took a look to a tutorial but i
haven't been able to figure how to accomplish what i want), i just
need for a piece of code to do this thing:

to write a document that when it's loaded in the window it just looks
like this:

" [click here to expand all] [click here to collapse all]
chapter1 [click here to expand]
chapter2 [click here to expand]
chapter3 [click here to expand]"
and when one clicks, for instance on "[click here to expand]" of
chapter1, it should look like this:

"chapter1 [click here to collapse]

blah blah blah blah ...(text of chapter1)

chapter2 [click here to expand]
chapter3 [click here to expand]"

and when one clicks on [click here to collapse], it should look again
as before being expanded.

the "[click here to expand]" should be just a text string or an image
or a link.
can anybody provide this code?
thank you very much,
maria laura.

---norobs
Jul 23 '05 #1
1 1230


M. L. C. wrote:

to write a document that when it's loaded in the window it just looks
like this:

" [click here to expand all] [click here to collapse all]
chapter1 [click here to expand]
chapter2 [click here to expand]
chapter3 [click here to expand]"
and when one clicks, for instance on "[click here to expand]" of
chapter1, it should look like this:

"chapter1 [click here to collapse]

blah blah blah blah ...(text of chapter1)

chapter2 [click here to expand]
chapter3 [click here to expand]"

and when one clicks on [click here to collapse], it should look again
as before being expanded.

the "[click here to expand]" should be just a text string or an image
or a link.


Here is an example script:
http://www.faqts.com/knowledge_base/...html/aid/32027
Note that it takes a different approach compared to your requirements,
while you want the links to collapse/expand to be present when the
document is loaded the example doesn't contain any such links, instead
script adds those links where possible after the document has been
loaded. That has the advantage that the page is readable/usable in
browsers where script is disabled or not supported.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: A P | last post by:
Hi! My first question was, can I hide a form field and make it visible upon selecting a particular value on a dropdown select field? Hoping for your immediate response. Me
5
by: didier Belot | last post by:
Hi! If the subject isn't clear: Modern browsers provide an optional way of remembering user input in textbox: user begin to type, and a list drop down just under the textbox showing matching...
5
by: news.west.cox.net | last post by:
I have something like this in a function: .... var box = document.getElementById("box"); box.style.visibility = 'hidden'; .... This hides a div setup like the following: <div id="box">
3
by: P.Hill | last post by:
I have this simple bit of code that when you check a checkbox and it displays or hides two other fields (well actually two parts of the document with two different IDs. Pretty straight forward......
2
by: c.anandkumar | last post by:
Hi All - I have some problems getting a small piece of javascript working correctly for Firefox. Here is what I am trying to do - 1. I have a form (like a search form) 2. I have many groups...
1
by: mauricio.silva | last post by:
Does anyone know of a way to hide the database window aside from the startup menu option that would prevent the window from showing ever when shift is held down while opening.
1
by: Sam Carleton | last post by:
Ok, have posted here before, but as a refresher, I have 8 years experience as a C/C++ Windows developer. Currently I am working on my first real web site using ASP.Net. I must admit that so far...
2
by: Ruskin Hardie | last post by:
There is an iframe in my document that is hidden, which is the target for a submitted form. When the form is submitted, some javascript sets a hidden div, to displaying, eg: ...
11
by: Mooglegiant | last post by:
I only get this bug in IE6. I have a floating hyperlink and when it floats over another hyperlink, the bottom hyperlink text is visible even with the other link floating over it. The work...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.