function myradio() { var radio=document.getElementById("r2"); var ch=document.getElementById("chbox"); if (radio.checked) { ch.value=checked; } else ch.value=0; }