473,396 Members | 1,714 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.

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

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.

Jul 23 '05 #1
2 1235
ta********@gmail.com wrote:
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
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'
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #3

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

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.