根本不需要传递aa,直接yy();return false就行<script language="javascript">
function yy(){
a1=document.form1.x1.value;
a2=document.form1.x2.value;
a3=document.form1.x3.value;
aa=document.form1.xx.value;
b1=eval(a1);
b2=eval(a2);
b3=eval(a3);
if (aa=="+")
{document.form1.x3.value=(b1+b2)
}
else if (aa=="-")
{document.form1.x3.value=(b1-b2)
}
else if (aa=="*")
{document.form1.x3.value=(b1*b2)
}
else if (aa=="/")
{document.form1.x3.value=(b1/b2)
}}
</script><form name=form1><table>
<tr><td><input type="text" name="x1" size="3"></td>&nbsp;<td>
<select name="xx"><option value="+">加</option>
<option value="-">减</option>
<option value="*">乘</option>
<option value="/">除</option></select>
</td>&nbsp;<td><input type="text" name="x2" size="3"></td>&nbsp;<td>=</td>&nbsp;
<td><input type="text" name="x3" size="3"></td>
<td><input type="submit" value="确定"onclick="yy();return false">
<input type="reset" value="取消"></td></tr></table></form>

解决方案 »

  1.   

    <script language="javascript">
    function yy(){
    a1=document.form1.x1.value;
    a2=document.form1.x2.value;
    a3=document.form1.x3.value;
    aa=document.form1.xx.value;
    b1=eval(a1);
    b2=eval(a2);
    b3=eval(a3);
    if (aa=="+")
    {document.form1.x3.value=(b1+b2)
    }
    else if (aa=="-")
    {document.form1.x3.value=(b1-b2)
    }
    else if (aa=="*")
    {document.form1.x3.value=(b1*b2)
    }
    else if (aa=="/")
    {document.form1.x3.value=(b1/b2)
    }}
    </script><form name=form1><table>
    <tr><td><input type="text" name="x1" size="3"></td>&nbsp;<td>
    <select name="xx"><option value="+">加</option>
    <option value="-">减</option>
    <option value="*">乘</option>
    <option value="/">除</option></select>
    </td>&nbsp;<td><input type="text" name="x2" size="3"></td>&nbsp;<td>=</td>&nbsp;
    <td><input type="text" name="x3" size="3"></td>
    <td><input type="button"  value="确定"onclick="yy()">
    <input type="reset" value="取消"></td></tr></table></form>如上。
    有俩个问题:
    1)函数你没必要传入参数aa吧,也没有用
    2)你确定按纽设置成submit,那即便你对了也看不到效果。
      

  2.   

    为了保证代码的通用性
    我建议大家写代码的时候给html控件搞个id
    然后document.getElementById来获得
    要不你在ie下正常
    但是脱离了ie可能理都不理