欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS獲取時(shí)間的方法

 更新時(shí)間:2015年01月21日 10:29:18   投稿:shichen2014  
這篇文章主要介紹了JS獲取時(shí)間的方法,涉及date的相關(guān)使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了JS獲取時(shí)間的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

復(fù)制代碼 代碼如下:
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title></title> 
    <script type="text/javascript"> 
        function Case(i) { 
            if (i < 10) { 
                i = "0" + i; 
            } 
            return i; 
        } 
        function getdata() { 
            var bnt = document.getElementById("id1") 
            var date = new Date(); 
            bnt.value =Case( date.getHours()) + ":" + Case(date.getMinutes()) + ":" +Case( date.getSeconds()); 
        } 
    </script> 
</head> 
<body> 
<input type="button" value="獲取時(shí)間" id="id1" onclick="setInterval(getdata, 1000)"/> 
</body> 
</html>

希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論