zoukankan      html  css  js  c++  java
  • 检测奇偶性

     1 <!DOCTYPE html>
     2 <html>
     3 <head lang="en">
     4     <meta charset="UTF-8">
     5     <title></title>
     6     <style type="text/css">
     7         body {
     8             font-size: 12px;
     9         }
    10 
    11         fieldset {
    12             width: 260px;
    13         }
    14 
    15         #tip {
    16             margin: 8px 0px;
    17             padding: 5px;
    18             border: solid 1px #ffdb15;
    19             background-color: #ffe6da;
    20             color: #666;
    21             display: none;
    22         }
    23     </style>
    24     <script type="text/javascript" src="js/system.js"></script>
    25 </head>
    26 <body>
    27 <fieldset>
    28     <legend>检测奇偶性</legend>
    29     <input type="text" id="txtN"/>
    30     <input type="button" value="检测" id="blnC">
    31 
    32     <div id="tip"></div>
    33 </fieldset>
    34 <script type="text/javascript">
    35     var time = 1, HTML = "";
    36     $$("blnC").onclick = function () {
    37         if (time <= 5) {
    38             var $n = $$("txtN").value;
    39             if (Number($n)) {                              //判断是否是数字
    40                 HTML = ($n % 2) ? "奇数" : "偶数";
    41             } else {
    42                 HTML = "你输入的不是数字!";
    43             }
    44             time++;
    45         } else {
    46             HTML = "今天你已经超过5次了!";
    47         }
    48         $$("tip").style.display = "block";
    49         $$("tip").innerText = HTML;
    50     }
    51 </script>
    52 </body>
    53 </html>
  • 相关阅读:
    TCP全局同步
    pytest框架之fixture详细使用
    库操作和表操作
    封装之如何隐藏对象及封装的意义
    类的抽象
    组合
    在子类中重用父类的方法和属性
    类的继承和实现原理
    类的使用,对象的使用
    互联网协议的五层协议详解
  • 原文地址:https://www.cnblogs.com/zfj-world/p/4771454.html
Copyright © 2011-2022 走看看