themost
<!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
}

 

分类:

技术点:

相关文章:

  • 2021-11-27
  • 2021-11-27
  • 2021-11-27
  • 2021-11-27
  • 2021-11-15
  • 2022-01-16
  • 2021-05-23
  • 2022-02-08
猜你喜欢
  • 2021-11-27
  • 2021-11-27
  • 2022-02-08
  • 2021-11-27
  • 2021-11-27
  • 2021-07-21
相关资源
相似解决方案