实时输入数量+单价自动转换为货币形式并计算出总额
来源:互联网 发布:mac版微信备份在哪里 编辑:程序博客网 时间:2024/04/29 00:26
<script>
function checkInt(o){
theV=isNaN(parseInt(o.value))?0:parseInt(o.value);
if(theV!=o.value){o.value=theV;}
txtTotal.value=txtAmount.value*txtPrice.value;
}
function checkP(o){
theV=isNaN(parseFloat(o.value))?0:parseFloat(o.value);
theV=parseInt(theV*100)/100;
if(theV!=o.value){
theV=(theV*100).toString();
theV=theV.substring(0,theV.length-2)+"."+theV.substring(theV.length-2,theV.length)
o.value=theV;
}
txtTotal.value=txtAmount.value*txtPrice.value;
}
</script>
数量:
<input id=txtAmount value=0 onkeyup="checkInt(this);" onpaste="checkInt(this);" oncut="checkInt(this);" ondrop="checkInt(this);" onchange="checkInt(this);">
单价:
<input id=txtPrice value=0 onkeyup="checkP(this);" onpaste="checkP(this);" oncut="checkP(this);" ondrop="checkP(this);" onchange="checkP(this);" style="border-right-width:0px;margin-right:0px;">
<input style="border-left-width:0px;margin-left:-4px;width:18px" value="¥" readonly>
总价:
<input id=txtTotal value=0 style="border-right-width:0px;margin-right:0px;" readonly>
<input style="border-left-width:0px;margin-left:-4px;width:18px" value="¥" readonly>
function checkInt(o){
theV=isNaN(parseInt(o.value))?0:parseInt(o.value);
if(theV!=o.value){o.value=theV;}
txtTotal.value=txtAmount.value*txtPrice.value;
}
function checkP(o){
theV=isNaN(parseFloat(o.value))?0:parseFloat(o.value);
theV=parseInt(theV*100)/100;
if(theV!=o.value){
theV=(theV*100).toString();
theV=theV.substring(0,theV.length-2)+"."+theV.substring(theV.length-2,theV.length)
o.value=theV;
}
txtTotal.value=txtAmount.value*txtPrice.value;
}
</script>
数量:
<input id=txtAmount value=0 onkeyup="checkInt(this);" onpaste="checkInt(this);" oncut="checkInt(this);" ondrop="checkInt(this);" onchange="checkInt(this);">
单价:
<input id=txtPrice value=0 onkeyup="checkP(this);" onpaste="checkP(this);" oncut="checkP(this);" ondrop="checkP(this);" onchange="checkP(this);" style="border-right-width:0px;margin-right:0px;">
<input style="border-left-width:0px;margin-left:-4px;width:18px" value="¥" readonly>
总价:
<input id=txtTotal value=0 style="border-right-width:0px;margin-right:0px;" readonly>
<input style="border-left-width:0px;margin-left:-4px;width:18px" value="¥" readonly>
- 实时输入数量+单价自动转换为货币形式并计算出总额
- 实时输入数字自动转换为货币形式并计算
- 将用户输入的小写货币形式转换为规范的大写货币形式
- 将用户输入的小写货币形式转换为规范的大写货币形式
- DataGrid中实现输入数量和金额自动计算出总金额
- 输入个人月收入总额,计算出本月应缴税款
- easyui----行内编辑---有单价 输入数量自动计算总金额
- JS数字金额转换为货币汉字形式
- JS数字金额转换为货币汉字形式
- 在EditText输入文本并实时改变文本的数量
- 输入mac地址,jq自动实时转换
- python3如何将input输入的字符串转化为表达式并计算出结果
- 3.7 编写一个程序,以字符形式输入某进制的数字,将其转换为十进制数值并显示出
- 输出为货币形式:$198,并将$198反向解析成整数198
- 数量*单价=金额
- 【华为面试】将输入的数字转换为大写形式
- 编写选择结构程序,输入个人月收入总额,计算出他本月应缴税款和税后收入
- EditText 输入字母自动转换为大写
- 对话框背景色的设置
- JS 被呼叫方(服务器〔不是服务器应用程序〕)不可用
- const 用法(转载)
- 子类父类方法与属性的调用(2).txt
- 关于Eclipse的Axis2插件的安装
- 实时输入数量+单价自动转换为货币形式并计算出总额
- ASN.1编码学习笔记二
- 子类父类方法与属性的调用(3)
- [ZZ]distinct 用法
- 子类父类方法与属性的调用(4)
- 电力设备在线检测方法选择排序
- 子类构造函数必须先初始化父类
- SimpleDateFormat的用法
- RedHat Enterprise 5 的遠端桌面連線設定