Rotate Shown Question

[Total: 0    Average: 0/5]

This example shows how to have DHTML show and hide componts in a form.

Head Code:

<script>
function Z(c)
{
var a="";
for(var b in c)
a+=b+" * ";
return(a);
}
function itemSelected(_v)
{
  if(_v.name=="a1")
  {
    document.all.span_a1.style.visibility="hidden";
    document.all.span_a1.style.height=0;
    document.all.span_b1.style.visibility="visible";
  }
  if(_v.name=="b1")
  {
    document.all.span_b1.style.visibility="hidden";
    document.all.span_c1.style.visibility="visible";
  }
  if(_v.name=="c1")
  {
    document.all.span_c1.style.visibility="hidden";
    document.all.span_a1.style.visibility="visible";
  }
}
</script>

Body Code:

<form name=exf1>
<div id=span_a1 style="visibility:visible">
Question A:
A1<input name="a1" type="radio" value="A1" onclick="itemSelected(this)">
A2<input name="a1" type="radio" value="A2" onclick="itemSelected(this)">
A3<input name="a1" type="radio" value="A3" onclick="itemSelected(this)">
A4<input name="a1" type="radio" value="A4" onclick="itemSelected(this)">
</div>
<hr width=50% height=1 color=steelblue align=center>
<div id=span_b1 style="visibility:hidden">
Question B:
B1<input name="b1" type="radio" value="B1" onclick="itemSelected(this)">
B2<input name="b1" type="radio" value="B2" onclick="itemSelected(this)">
B3<input name="b1" type="radio" value="B3" onclick="itemSelected(this)">
B4<input name="b1" type="radio" value="B4" onclick="itemSelected(this)">
</div>
<hr width=50% height=1 color=steelblue align=center>
<span id=span_c1 style="visibility:hidden">
Question C:
C1<input name="c1" type="radio" value="C1" onclick="itemSelected(this)">
C2<input name="c1" type="radio" value="C2" onclick="itemSelected(this)">
C3<input name="c1" type="radio" value="C3" onclick="itemSelected(this)">
C4<input name="c1" type="radio" value="C4" onclick="itemSelected(this)">
</span>
</form>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *