PDA

View Full Version : Button to Show/Hide Div



many_tentacles
20 Mar 2006, 08:25 AM
I am trying to create a button which makes a div appear when clicked and disappear when clicked again.... then appear, then disappear.
I'm nearly there, the div appears, but then rather than just that div disappearing when you click again, everything disappears! I'm sure its simple to work out for people who are confident using Javascript. Not for me though!

Here's the link

www.standardcraze.co.uk/test.htm

Thanks

Arkette
20 Mar 2006, 11:01 AM
You are iterating through an array which contains references to all the divs on the page and then setting them to display:none. The problem is everything on the page is in a div. If you want to exclude the button for example then either take it out of the enclosing div or give it an id and branch your code to step over it in the array.