日期:2014-05-16 浏览次数:20577 次
<script language="javascript">
function heji()
{
var t1,t;
obj = document.getElementById("shuliang1");
obj2 = document.getElementById("yuanjia");
t=obj.value*obj2.value;
t1=obj.value*1
document.getElementById("heji").innerHTML = t1+"件"+(Math.round(t*100)/100)+"元"
}
</script>
<form method="post" name="myform" >
数量:<input type="text" name="shuliang1" size="3" tabindex="6">
金额:<input type="text" name="yuanjia" size="3" tabindex="6">
<input type="button" value="计 算" onClick="heji();" class="button"> <span id="heji"></span>
</form>
obj = document.getElementsByName("shuliang1")[0];
obj2 = document.getElementsByName("yuanjia")[0];
obj = $('.shuliang1').val();
obj2 = $('.yuanjia').val();
t=obj*obj2;