[RESOLVED] Radio Buttons to Show/Hide DIVS
I'm trying to get my form to show and hide various divs with radio buttons. There are multiple options in the second box of my example. When a user selects the first option, more input boxes come up. Perfect, that's what I want. However, if they decide they didn't mean to click that option and instead wanted another option, the original part that popped up doesn't disappear. I cannot figure out how to make this happen. Can you help?
Site here: http://www.uwstout.edu/static/housin...Spring/bye.asp
Check this earlier thread: showthread.php?t=209567
onclick="hideDiv('coop') showDiv('leavingNow')" doesn't work. Am I close?
is how it's used. The visibility and position attributes are changed on all divs but only the one you selected becomes visible. You only have to specify one function on your onClick statement on the form, i.e., onClick="setPage('solver');"
function showPage(sPage, bShow) //hides all but selected div
var div = document.getElementById(sPage);
div.style.visibility = bShow ? 'visible' : 'hidden';
div.style.position = bShow ? 'static' : 'absolute';
showPage('start', sPage == 'start');
showPage('details', sPage == 'details');
showPage('solver', sPage == 'solver');
showPage('about', sPage == 'about');
if (right conditions are met) setPage('about');
haha! That's fantastic. Thank you!
You're welcome. Glad it worked out.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)