<script>
function Chenge(obj) {
t3.value=obj.value*t2.value;
}
</script>
<table border="1" width="100%" id="table1">
<tr>
<td> <input type=text id=t1 onChange="Chenge(this);">数量</td>
<td> <input type=text id=t2>价格</td>
<td> <input type=text id=t3>总价格</td>
</tr>
</table>

解决方案 »

  1.   

    你试试
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <meta http-equiv="content-type" content="text/html" charset="utf-8">
    <script type="text/javascript">function Chenge()
    {
    var account = 0.00
    var showNode = document.getElementById("total");
    var quanlity = document.getElementById("t1").value;
    var price = document.getElementById("t2").value;
    if ( quanlity== "")
    {
    showNode.innerHTML = "请输入数量!!";
    return false;
    }
    account = parseInt(quanlity)*parseFloat(price);
    showNode.innerHTML = account;
    }</script>
    </HEAD><BODY><table border="1" width="60%" id="table1">
    <tr>
    <td>数量<input type=text id='t1' value="0" onkeyup="Chenge();"></td>
    <td>价格<input type=text id='t2' value="1.5"></td>
    <td width="80">总价格<div id="total" style="font-size:13pt;font-weight:800;color:red;">0.00</div></td>
    </tr>
    </table>
    </BODY>
    </HTML>