金额1<input type=text name=text1 value=0 onpropertychange=woyingjie()>
金额2<input type=text name=text2 value=0 onpropertychange=woyingjie()>
金额3<input type=text name=text3 value=0 onpropertychange=woyingjie()>
总计<input type=text name=text4 value=0>
<script>
function woyingjie(){
var text1=parseInt(document.all.text1.value);
var text2=parseInt(document.all.text2.value);
var text3=parseInt(document.all.text3.value);
var text4=text1+text2+text3;
document.all.text4.value=text4;
}
</script>
金额2<input type=text name=text2 value=0 onpropertychange=woyingjie()>
金额3<input type=text name=text3 value=0 onpropertychange=woyingjie()>
总计<input type=text name=text4 value=0>
<script>
function woyingjie(){
var text1=parseInt(document.all.text1.value);
var text2=parseInt(document.all.text2.value);
var text3=parseInt(document.all.text3.value);
var text4=text1+text2+text3;
document.all.text4.value=text4;
}
</script>
解决方案 »
- jquery判断一个div层中所有text类型的文本框是否有为空的文本框
- 关于Js后加载,出现加载2次的解决办法。
- js有哪些现成的框架,分别怎么使用它们?
- 这样的效果如何实现?
- [求助]一个关于自动向网页表单提交数据的问题
- 请问如何在网页上做一个最小化窗口的按钮?
- seabell(百合心),请进来一下。
- window.form1.submit()或者document.form1.submit()在netscape中不起作用,请问该如何解决
- 用javascript能显示ActiveX控件下载的进度吗?
- jquery中导出excel等报表文件
- 紧急求助,select控件更新(在线等待)
- 在父窗口有<iframe id=textEdit>,那么在其他窗口选择了要插入图片的路径,怎么把图片插入到父窗口的<iframe>里,谢谢
金额1<input type=text name=price value=0 onpropertychange=calc()>
金额2<input type=text name=price value=0 onpropertychange=calc()>
金额3<input type=text name=price value=0 onpropertychange=calc()>
总计<input type=text name=sumprice value=0>
</form><script>
function calc()
{ var sum=0;
for(var i=0;i<form1.price.length;i++)
{
if (!isNaN(Number(form1.price[i].value)) sum+=Number(form1.price[i].value);
}
form1.sumprice.value=sum;
}
</script>