The method in this article is super simple and the ideas are highly recommended. Friends, please refer to it
javascript simple calculator
<script> <br>
//Define global variables var one="1"; <br>
var two="2"; <br>
var three="3"; <br>
var four="4"; <br>
var five="5"; <br>
var six="6"; <br>
var seven="7"; <br>
var eight="8"; <br>
var nine="9"; <br>
var zero="0"; <br>
var plus=" ",minus="-",multiply="*",divide="/",decimal="."; <br>
function enter(obj,string){ <br>
to
} <br>
function compute(obj){//The function called by clicking the equals "=" button; obj.expr.value=eval(obj.expr.value);//Use JS to get the eval() method to calculate name as the formula in expr } <br>
</script>
是不是超级NB的代码,大神级的!
Statement: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