<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>计算</title>
</head>
<script>
function get_num()
{
aValue = document.getElementsByName('a')[0].value;
bValue = document.getElementsByName('b')[0].value;
document.getElementsByName('c')[0].value = aValue * bValue;
}
</script><body>
<form name="form1" method="post" action="">
  <p>
  数a<input type="text" name="a" onblur="get_num()">
 </p>
  <p>
    数b<input type="text" name="b" onblur="get_num()">
  </p>
  <p>
    积c<input type="text" name="c">
</p>
</form>
</body>
</html>

解决方案 »

  1.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>计算</title>
    <script>
    function f1()
    {
     alert(eval((document.all.Text1.value)*(document.all.Text2.value)))
    }
    </script>
    </head><body>
    <form name="form1" method="post" action="" ID=Form1>
      <p>
      数a<input type="text" name="a" ID=Text1>
     </p>
      <p>
        数b<input type="text" name="b" ID=Text2>
      </p>
      <p>
       <input type="button" onclick=f1()>
    </p>
    </form>
    </body>
    </html>
      

  2.   

    <script  language="javascript">
    function Ma()
    {
    if(Num2.value != "")
    {
    Num3.value = Number(Num1.value)*Number(Num2.value);}
    }
    </script><body>
    <input type="text" id="Num1" onpropertychange="Ma()">*<input type="text" id="Num2" onpropertychange="Ma()">=<input type="text" id="Num3" readonly=>
    </body>
    </html>
      

  3.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>计算</title>
    <script language="javascript">
    function sumValue(){
    var valueA = form1.a.value;
    var valueB = form2.b.value;
    if(valueA == ""){
    valueA = parseFloat(0);
    }else{
    valueA = parseFloat(valueA);
    }
    if(valueB = ""){
    valueB = parseFloat(0);
    }else{
    valueB = parseFloat(valueB);
    }
    form1.c.value = valueA * valueB;
    }
    </script>
    </head><body>
    <form name="form1" method="post" action="">
      <p>
      数a<input type="text" name="a" onblur="sumVaule()">
     </p>
      <p>
        数b<input type="text" name="b" onblur="sumValue()">
      </p>
      <p>
        积c<input type="text" name="c">
    </p>
    </form>
    </body>
    </html>
      

  4.   

    sanshisong(三师兄)的程序最好,能动态更新结果。
    zhiin(┈ Jcan ┈) 的程序也能运行。
    tragedy(我要读书)的程序有异常