View Full Version : onclick show, hide all other divs in container + set cookie

12-05-2004, 11:24 AM
Wow.. google gave me the correct forum to go to :) ..
Basically I'm having problems with something I don't know how to do.. I'm not a javascript guy at all, I understand PHP and can write some of it myself.. but writing complex scripts isn't really my thing. but this shouldn't be too hard..
- I'm going to show an example of what I'm trying to do..
I'm using divs.. basically 1 container div for 3 divs that have display: none;

the top of the divs will be ______ and the bottom will be -------
[img link 1] [img link 2] [img link 3]
<!-- the 3 divs start here -->
1) stuff is in here...
2) here too
3) hey, how about here too
<!-- closing container div -->
I've found tons of ways to 'show or hide' using javascript and display: none;
but no way to do this..
when [img link 1] is clicked, the rest hide but DIV 1 shows.. when [img link 2] is clicked, the rest hide but DIV 2 shows.. etc..
that's one tricky part I'm hoping someone knows..
the other tricky part is that everytime someone clicks the link, it needs to set a cookie so that when they go to other pages, that same div is showing.. (so it doesnt hide) .. unless that can be done without cookies.. doesn't matter to me..
this has to be done without the page reloading (which is why I don't use PHP, the way I know how to..) but the cookie can be set with PHP if needed (that's the only way I know)... if someone can help me, that'd be awesome.
-thanks for any help :D
-- I know of 1 site that has this, except without the cookie.. if that helps.. (and yes, I've looked at the source.. still don't know how to edit their javascript)
site is http://www.team3d.net/ and it's the pictures of faces (profiles I guess).. on the right side.
Look directly above the faces, CS or COD click them, and also that little button to the right of COD... that's exactly what I'm trying to do (except set a cookie so when the user goes to a new page, it's displaying the same one)