熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

js局部刷新頁面時間具體實現

2013-11-15 12:02:59  來源: JSP教程 
這篇文章介紹了js局部刷新頁面時間具體實現需要的朋友可以參考一下   復制代碼 代碼如下:

  
<head>
    <title></title>
    <script type="text/javascript">
        function GetTime() {
            var time = new Date();
            var year = timegetFullYear();
            var month = timegetMonth() + ;         // 月份從開始
            var day = timegetDate();                // 注意是getDate()
            var hour = timegetHours();
            var minute = timegetMinutes();
            var sec = timegetSeconds();
            var timestring;
            if (minute < ) {
                timestring
                    = year + "" + month + "" + day + " " + hour + ":" + minute + ":" + sec;
            }
            else {
                timestring
                    = year + "" + month + "" + day + " " + hour + ":" + minute + ":" + sec;
            }
            // div沒有value屬性
            documentgetElementByIdx_x("timeDiv")innerHTML = timestring;
            windowsetInterval("GetTime()" );
        }
    </script>
</head>
<body onload="GetTime()">
    <div id="timeDiv">
    </div>
</body>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20158.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.