zoukankan      html  css  js  c++  java
  • javascript平时小例子③(setInterval使用1)

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title></title>
    <style>
    .lala{
    text-align: center;
    }
    </style>
    </head>
    <body>
    <div class="lala">
    <input type="button" value="当前时间" onclick="anniu()"/ style=" 80px;height: 20px;" >
    <input type="text" id="xi"/>
    <script>


    setInterval(function anniu(){
    var oDate = new Date();
    var oyear=oDate.getFullYear();
    var month=oDate.getMonth()+1;
    var day=oDate.getDate();
    var hours=oDate.getHours();
    var minutes=oDate.getMinutes();
    var seconds=oDate.getSeconds();

    document.getElementById("xi").value=oyear+"年"+month+"月"+day+"日"+hours+"时"+minutes+"分"+seconds+"秒"
    },1000);




    </script>
    </div>
    </body>

    </html>

  • 相关阅读:
    安卓-登陆页面的实现
    异常
    实用类
    Hashset
    Map
    LinkedList
    arraylist
    继承
    字符串相关代码
    数组代码
  • 原文地址:https://www.cnblogs.com/cxy66/p/6050245.html
Copyright © 2011-2022 走看看