hidding and showing text

M

M. L. C.

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
 
M

Martin Honnen

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/view.phtml/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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top