检查代码...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function operation(thevalue)
{
var result;
var one=document.forms["myform1"]["one"];
var two=document.forms["myform1"]["two"];
document.write(one);
var x=document.getElementById(thevalue).value;
if(x == "add")
{
result=one+two;
alert ("Answer is : "+result);
}
}
</script>
</head>
<body>
<form name="myform1">
Enter 1st no :<input type="text" name="one" /><br/>
Enter 2nd no :<input type="text" name="two" /><br/>
<input type="radio" id="add" name="operation" value="add" onclick="operation(this.value)" />Add
<input type="radio" id="sub" name="operation" value="sub" onclick="operation(this.value)" />Sub
<input type="radio" id="mul" name="operation" value="mul" onclick="operation(this.value)" />Mul
<input type="radio" id="div" name="operation" value="div" onclick="operation(this.value)" />Div
</form>
</body>
</html>