问题:
1、输入购车价格,如何直接输出金额选项里。  
2、购置税选项里,用户选择某项(1.6L以上)直接输出,计算好金额。
  声明:没有提交按钮,也不用按回车键。只要用户输入购车金额,直接输出各项计算值。下面代码无法实现我所需要功能,请大侠们帮我修改:
<form id="form1" name="form1" method="post" action="">
<table width="800"  border="0" cellpadding="3" cellspacing="1"   >
  <tr bgcolor="#FFCC99">
  <td>
    <div align="center">输入购车价格:
      <input type="text" name="price" checked="checked" value="<?php echo $_POST["price"]?>" /> 
      万元
    </div></td>
  </tr>
</table>
<table width="800"  border="0" cellpadding="3" cellspacing="1"   >
    <tr bgcolor="#FFCC99">
      <td width="77">款项</td>
      <td width="147">选项</td>
      <td width="368">金额</td>
    </tr>
<tr>
<td>现款购车价格</td>
<td></td>
<td><input name="textfield" type="text" size="12" value="<?php $jg=$_POST["price"];echo $jg;?>"/></td>
</tr>
    <tr bgcolor="">
      <td>购置税</td>
      <td>
  <input type="radio" name="radiobutton" value="radiobutton"/>免税
      <input type="radio" name="radiobutton" value="radiobutton" />1.6L及以下
      <input type="radio" name="radiobutton" value="radiobutton" />1.6L及以上   
  </td>
      <td><p>
          <input name="textfield2" type="text" size="12" />
        元 </p>
        <p>购置附加税=购车款/(1+17%)*购置税(1.6L以下为7.5%,其他为10%)</p></td>
    </tr>
</table>
</form>

解决方案 »

  1.   

    要判断浏览器,如果是ff那么就要用onchange,如果是ie就要用onpropertychange
      

  2.   

    看到FF和IE就气人。
    妈的,就没有统一的标准吗?
    写个js还要判断用的什么浏览器。
      

  3.   


    <form id="form1" name="form1" method="post" action="">
    <table width="800" border="0" cellpadding="3" cellspacing="1" >
      <tr bgcolor="#FFCC99">
      <td>
      <div align="center">输入购车价格:
      <input type="text" name="price" checked="checked" value="<?php echo $_POST["price"]?>" onchange="car(this.value)"/>  
      万元
      </div></td>
      </tr>
    </table>
    <table width="800" border="0" cellpadding="3" cellspacing="1" >
      <tr bgcolor="#FFCC99">
      <td width="77">款项</td>
      <td width="147">选项</td>
      <td width="368">金额</td>
      </tr>
    <tr>
    <td>现款购车价格</td>
    <td></td>
    <td><input name="textfield" type="text" size="12" value="<?php $jg=$_POST["price"];echo $jg;?>"/></td>
    </tr>
      <tr bgcolor="">
      <td>购置税</td>
      <td>
    <input type="radio" name="radiobutton" value="1"/>免税
      <input type="radio" name="radiobutton" value="0.075" />1.6L及以下
      <input type="radio" name="radiobutton" value="0.1" />1.6L及以上   
    </td>
      <td><p>
      <input name="textfield2" type="text" size="12" />
      元 </p>
      <p>购置附加税=购车款/(1+17%)*购置税(1.6L以下为7.5%,其他为10%)</p></td>
      </tr>
    </table>
    </form>
    <script language="javascript">
    function car(val)
    {
    var radiobutton = "";
    for(var i=0;i<3;i++)
    {
    if(document.form1["radiobutton"][i].checked)
    {
    radiobutton = document.form1["radiobutton"][i].value;
    }
    }
    if(radiobutton == "")
    {
    alert('选择税别');
    document.form1.price.value = "";
    return;
    }
    document.form1.textfield.value = val;
    document.form1.textfield2.value = Math.floor(val / 1.17 * radiobutton);}
    </script>
    大概这样
      

  4.   

    不是把用onkeydown="" 不是也能实现么
      

  5.   

    用jq之类的库,就不需要考虑这么多。
    用js计算就行了。