Click to See Complete Forum and Search --> : Creating a form when a certian checkbox is clicked stuff shows up.


krrose27
03-28-2006, 08:05 PM
I have never used java sbefore in websites but people tell me this is where it would be used.
I have a form, and lets say they check this radio button that says maried, well when they do more stuff will pop up under it thatll have all these trhings like 1year {radio button} 2 years {radio button} and so forth and so on.

That was just an example. Any clue on how to do that?

bpat1434
03-28-2006, 10:17 PM
You could have the form hard coded in there, and just set the visibility to visible or display to block when they check the checkbox. I'm not big in JS (just learning) but I know it's possible. Something with document.getElementById.(id_name).style='visibility: hidden' or something like that.

JPnyc
03-28-2006, 11:23 PM
Well to clear up a popular misconception, it's Javascript, not Java. The 2 are not related.

Yes, you use either document.getElementById('idname').style.visibility or you can use

document.getElementById('idname').style.display="none" or "block"

Or since they're in a form, you can reference like this:

document.forms[0].elements[elementNumber].style

Put a 0 in place of element number for the 1st element,1 for the 2nd, 2 for the 3rd, etc.