Not sure how I would build this but I want to make a javascript that will generate text based on a switch. It will also need to generate text for radio buttons based on the selected switch variable as well. Basicly I want to build something to generate a question and multipal choice answer. Ive got this code so far with a little help from another post.

Code:
 <script type="text/javascript">
	function myfunction(obj)
    {
        var mycolor = obj.value;

        switch (mycolor) 
        {
            case "Blue":
				alert("Blue");
				break;
				
			case "Red":
				alert("Red");
				break;
				
			case "Green":
				alert("Green");
				break;
				
			case "Yellow":
				alert("Yellow");
				break;
        }
    }
	</script>
</head>
<body>
<div id="choices" >
	<input type="radio" name="group1" onclick="myfunction();" value="Blue" />Blue <br/>
	<input type="radio" name="group1" onclick="myfunction();" value="Red" />Red <br/>
	<input type="radio" name="group1" onclick="myfunction();" value="Green" />Green <br/>
	<input type="radio" name="group1" onclick="myfunction();" value="Yellow" />Yellow <br/>
</div><br/>
So I guess the best way to do it would be make a new function to generate the Q/A thing and put the text inside the form but how do I do that and would that be the best way?