定時器

1.定時器的基本使用

  開啓:timer = setInterval(函數,時間)  //無限次數的執行

              setTimeout(函數,時間)  //只執行一次

  關閉:clearInterval(timer);//關閉相應的計時器

             clearTimeout();

2.數碼時鐘

  獲取系統時間:Date對象

            var oDate = new Date();

            oDate.getHours() ;時

            oDate.getMinutes();分

            oDate.getSeconds();秒

   charAt(字符串);  取字符串的某一位,解決兼容性

         oDate.getFullYear(); 年

          oDate.getMonth()+1; 月

          oDate.getDate();  日

          oDate.getDay();   星期幾

3.延時提示框(延時提示框代碼

  使用setTimeout

4.無縫滾動(無縫滾動代碼

   offsetWidth

   offsetLeft



 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章