• 计算器


      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8">
      <title>Jiusanqi</title>
      <style>
       
      table{
      height: 350px;
      270px;
      text-align: center;
      }
      input{
      height: 100%;
      350px;
      font-size: 50px
      }
      </style>
      </head>
      <body>
       
       <table border="1" align="center" bgColor="#00bfff" >
      <tr>
        <td colspan="4">
      <input type="text" id="nummessege" />
        </td>
      </tr>
      <tr>
        <td onclick="onclicknum(1)">
      1
        </td>
       
        <td onclick="onclicknum(2)">
      2
        </td>
       
        <td onclick="onclicknum(3)">
      3
        </td>
       
        <td onclick="onclicknum('+')">
      +
        </td>
      </tr>
       
      <tr>
        <td onclick="onclicknum(4)">
      4
        </td>
       
        <td onclick="onclicknum(5)">
      5
        </td>
       
        <td onclick="onclicknum(6)">
      6
        </td>
       
        <td onclick="onclicknum('-')">
      -
        </td>
      </tr>
       
      <tr>
        <td onclick="onclicknum(7)">
      7
        </td>
       
        <td onclick="onclicknum(8)">
      8
        </td>
       
        <td onclick="onclicknum(9)">
      9
        </td>
       
        <td onclick="onclicknum('*')">
      *
        </td>
      </tr>
       
      <tr>
        <td colspan="2" onclick="onclicknum(0)">
      0
        </td>
        <td onclick="onclicknum('.')">
      .
        </td>
       
        <td onclick="onclicknum('/')">
          /
        </td>
        </tr>
       
        <tr>
       
        <td colspan="2" onclick="onclickclear()">
      Del
        </td>
       
        <td colspan="2" onclick="onclickresult()">
      =
        </td>
       
      </tr>
       
        </table>
      <script>
      let numresult;
      let str;
       
      function onclicknum(nums) {
      str = document.getElementById("nummessege");
      str.value = str.value + nums;
      }
       
      function onclickclear() {
      str = document.getElementById("nummessege");
      str.value = '';  }
       
      function onclickresult() {
      str = document.getElementById("nummessege");
      numresult = eval(str.value);
          
      str.value = numresult;
      }
       
       
      </script>
       
      </body>
      </html>
  • 相关阅读:
    mysql
    MySQL主从同步
    python与各数据库的交互
    snmptrap
    web场景的监控
    zabbix的历史数据存储到elasticsearch中
    使用PopupWindow的实现步骤
    使用PopupWindow的实现步骤
    ListView及其ArrayAdapter的应用
    ListView及其ArrayAdapter的应用
  • 原文地址:https://www.cnblogs.com/9797ch/p/11360570.html
Copyright © 2020-2023  润新知