格式是在太乱了,下次一定整好再发上来,如果还是这样,懒得看了。
<html> 
<head> 
<script language="javascript"> 
      
  function operator() { 
      var n3;
      t1=parseFloat(document.myform.n1.value); 
      t2=parseFloat(document.myform.n2.value); 
      ms1=document.myform.m1;
  m1=ms1[0].checked?"+":ms1[1].checked?"-":ms1[2].checked?"*":"/";
  alert(m1);
      if(m1=="+"){ 
          n3=t1+t2; 
      } 
      else if(m1=="-"){ 
          n3=t1-t2; 
  } else if(m1=="*") 
          n3=t1*t2; 
      else if(m1=="/"){ 
          if(t2!=0){ 
              n3=t1/t2; 
          } else { 
          n3="除数不能为零"; 
      } 
      } 
      document.myform.n3.value=n3; 
  } 
</script> 
</head> <body> 
<form name="myform"> 
<input type="text" name="n1" value=""> 
<br> 
<input type="text" name="n2" value=""> 
<br> 
<input type="radio" name="m1" value="+"> 
相加 
<br> 
<input type="radio" name="m1" value="-" > 
想减 
<br> 
<input type="radio" name="m1" value="*" > 
相乘 
<br> 
<input type="radio" name="m1" value="/" > 
相除 
<br> <input type="button" name="button1" value="计算" onclick="operator()"> 
<input type="text" name="n3" value="" > 
</form> 
</body> 
</html>