zoukankan      html  css  js  c++  java
  • javascript进阶一

    一 window对象

      http://www.w3school.com.cn/jsref/dom_obj_window.asp

    二 setInterval的应用

      模拟计时器

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script>
            function foo() {
                var current_time=(new Date()).toLocaleString()
                var ele_input=document.getElementById('d1')
                ele_input.value=current_time
            }
    
            var ID;
            function begining() {
                if(ID==undefined){
                      foo()
                      ID=setInterval(foo,1000)
                }
            }
            function ending() {
                console.log('clear之前ID',ID)
                clearInterval(ID)
                console.log('clear之后ID',ID)
                ID=undefined
            }
        </script>
    </head>
    <body>
    <input type="text" id="d1"><button onclick="begining()">begin</button><button onclick="ending()">ending</button>
    </body>
    </html>

      输出:

      

    三  value固有属性的三个标签

      input标签

      textarea标签

      select下的option标签

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <from>
            <input type="text" value="1">
            <textarea name="" cols="30" rows="10" ></textarea>
            <select name="" id="">
                <option value=""></option>
            </select>
        </from>
    </body>
    </html>
  • 相关阅读:
    85. Maximal Rectangle
    120. Triangle
    72. Edit Distance
    39. Combination Sum
    44. Wildcard Matching
    138. Copy List with Random Pointer
    91. Decode Ways
    142. Linked List Cycle II
    异或的性质及应用
    64. Minimum Path Sum
  • 原文地址:https://www.cnblogs.com/654321cc/p/7810573.html
Copyright © 2011-2022 走看看