Show Answers – Select Box

[Total: 0    Average: 0/5]

This shows how to set up a Question/Answer with forms, and allow the user to deciede when it is ok to show the answer.

Body Code:

<form name=exf1>
<select size=1 name=q1 tabindex=1>
  <option value=0 selected>Question 1</option>
  <option value=1>Question 2</option>
  <option value=2>Question 3</option>
  <option value=3>Question 4</option>
</select>
<BR><input type=button value="Show A" onclick="showA()">
<br><input type=text name=t1 value="?">
</form>
<script type=text/javascript>
var _A = new Array();
    _A[0] = "A 1";
	_A[1] = "A 2";
	_A[2] = "A 3";
	_A[3] = "A 4";
function showA() {
  document.exf1.t1.value = _A[document.exf1.q1.value];
}
</script>

Times Viewed: 0

Leave a Reply

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