Home > Web Front-end > JS Tutorial > js code to automatically calculate the output amount after inputting the quantity and price_Form special effects

js code to automatically calculate the output amount after inputting the quantity and price_Form special effects

WBOY
Release: 2016-05-16 17:41:17
Original
2690 people have browsed it

[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<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>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template