Radio Button Selects Math Computation

[Total: 0    Average: 0/5]

This example uses radio buttons to determine which value to multiply the first text boxes number by

Body Code:

<form name=exf1>
<input type=text name=t1 value=5><BR>
<input type=radio name=r1 value="0.75" onclick="setVal(0.75)" checked>3/4<BR>
<input type=radio name=r1 value="0.50" onclick="setVal(0.50)"        >1/2<BR>
<input type=radio name=r1 value="0.25" onclick="setVal(0.25)"        >1/4<BR>
<input type=text name=t2 value="?"><BR>
<input type=button onclick="calcIt()" value="Compute">
var _val=0.75;
function setVal(_a) {_val=_a;}
function calcIt() {
  _v = parseInt(document.exf1.t1.value);

Times Viewed: 2

Leave a Reply

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