首页 > 其他 > 详细

自制计算器

时间:2018-02-18 20:13:39      阅读:250      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自制计算器</title>
    <script src="add.js" type="text/javascript"></script>
</head>
<body>
    <div align="center" style="margin-top: 60px">
        <img src="add.png">
    </div>
    <div align="center" style="margin-top: 80px">
        <form name="form1">
            <input type="text" name="add1" placeholder="add1">+
            <input type="text" name="add2" placeholder="add2">=
            <input type="text" readonly="readonly" name="result" placeholder="result">
            <input type="button" name="submit" value="计算" onclick="add()">
        </form>
    </div>

</body>
</html>


/**
 * Created by Administrator on 2018/2/18.
 */

function add() {
    var add1 = Number(document.form1.add1.value);
    var add2 = Number(document.form1.add2.value);
    var result = add1 + add2
    document.form1.result.value=result
}

 

自制计算器

原文:https://www.cnblogs.com/themost/p/8453107.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!