Page 1 of 1

hide icon

Posted: Thu Apr 28, 2005 6:13 pm
by Pyrite
I know what I want but I have trouble googling it.

I want to have a little icon like a + icon beside a paragraphic of text, so when clicked, will hide the paragraph beside it. What is that called or how is it done?

Thanks.

Posted: Thu Apr 28, 2005 6:37 pm
by Chris Corbyn
You can either play with the display property in the stylesheets object or use some DOM scripting.

For a quicker, easy to learn approach I'd just swicth between display='none' to display='block'

Might be useful to learn the DOM scripting side of JS though.

Google: "JavaScript DOM"

Posted: Fri Apr 29, 2005 4:05 am
by zenabi
More on what d11 was talking about can be found here:

http://www.stuffandnonsense.co.uk/archi ... ields.html

Posted: Sun May 01, 2005 11:25 pm
by Pyrite
Sorry I don't understand this clientside/dom stuff. Is there a way I can make it hide a paragraph and never show it again? Perhaps without reloading the page as well?

Posted: Mon May 02, 2005 2:53 am
by n00b Saibot
just set the paragraph's 'display' property to 'none' ;)
for e.g. you have a para with id = hideMe (defining id is important)

Code: Select all

<p id='hideMe'>I don't want this. Go away. Shooo</p>
<a href=&quote;#&quote; onclick='document.getElementById(&quote;hideMe&quote;).style.display = &quote;none&quote;'>Hide It!</a>
Use the link, and Voila! it's gone.