A copy of the JavaScript functions in the head element:
// sample-1-radio-button-processing.js
// This sample shows processing of radio buttons.
// onload set the body's color and background color
function loaded()
{
// reset division colors
var my_div = document.getElementById("my-div");
my_div.style.color = "green";
my_div.style.backgroundColor = "white";
// reset checked in all input elements (which are all radio button)
var my_form = document.getElementById("my-form");
for(var i=0; i < my_form.childNodes.length; i++)
{
if(my_form.childNodes[i].nodeName == "INPUT")
{
my_form.childNodes[i].checked = false;
}
}
}
// onclick copy radio button color and backgroundColor to the div
// the selected radio button object is passed as the argument
function color_radio_function(e)
{
var my_div = document.getElementById("my-div");
my_div.style.color = e.style.color;
my_div.style.backgroundColor = e.style.backgroundColor;
}