hide icon

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

hide icon

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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"
zenabi
Forum Commoner
Posts: 84
Joined: Mon Sep 08, 2003 5:26 am
Location: UK

Post by zenabi »

More on what d11 was talking about can be found here:

http://www.stuffandnonsense.co.uk/archi ... ields.html
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post 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?
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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.
Post Reply