css or javascript show/hide
- Started
- Last post
- 10 Responses
- rex_f
hello, I ws wondering if anyone knew how I could do the effect that is shown on this page:
http://www.archos.com/support/cu…
except only have one answer showing at a time. how would I swap them out without hardcoding each div name?
- heavyt0
so, you want the menu to force all closed, then open 1, so that only one answer shows at a time?
easiest way is to traverse the DOM, and put all of the elements that you want to show/hide into an array.
eg. var elems = document.getElementsByTagName('p...
Then set a class to show the selected answer and hide others.
eg. for(i=0;i
- TheBlueOne0
duct tape?
- rex_f0
yes. yes.
I have that part down already. I am just not sure how to call the "open" answers, though.and thank you for your help.
- acescence0
here's some code for something similar i did, hding all sequentially numbered section divs and showing selected one:
- version30
i use js at http://justingum.com/
just click the "Justin Gum" header
check the source and steal the files for all i care
- rex_f0
acescence's response seems like exactly what I want to do, but I am not sure how to incorporate that into the HTML...
no one else has done this before?
and thanks again.
- st33d0
Doing it without id attributes would be more pain than with IMO.
I use almost the method as acescence.
- acescence0
you owe me a cookie
- rex_f0
very close...
but I figured it out.
thanks SOO much for your help!in case anyone needs to do this:
function resetFaq() {
for (i=1;i
- rex_f0
whoops. that didn;t post the entire code... email me if you need it.
thanks again.