Making a text appear/dissapear (button [+] and [-])

T

tarmstrong

Hi.

I would like to create a [+] link next to a caption, and when user
clicks
it, a new text appears and [+] becomes [-].

And when users clicks [-], it becomes [+] and the text dissapears.

I don't remember which JavaScript property I must work with.
Thank you very much.
 
R

Randy Webb

Hi.

I would like to create a [+] link next to a caption, and when user
clicks
it, a new text appears and [+] becomes [-].

And when users clicks [-], it becomes [+] and the text dissapears.

I don't remember which JavaScript property I must work with.

Hmmmmm, lets see.

You need the onclick.
You need the visibility property.

That about covers what you want, at a minimum.

You could expand it and use the images collection.
You could also expand it and use innerHTML.

But neither is required. It can be done with onclick and visibility.
 
E

Evertjan.

wrote on 12 dec 2004 in comp.lang.javascript:
Hi.

I would like to create a [+] link next to a caption, and when user
clicks
it, a new text appears and [+] becomes [-].

And when users clicks [-], it becomes [+] and the text dissapears.

I don't remember which JavaScript property I must work with.
Thank you very much.

use CSS DOM:

document.getElementById('myCaption').style.display='none'
 

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
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top