2010年3月12日

          JavaScript Date 對象參考手冊

          Date 對象

          Date 對象用于處理日期和時間。

          創(chuàng)建 Date 對象的語法:

          var myDate=new Date()

          注釋:Date 對象會自動把當前日期和時間保存為其初始值。


          Date 對象屬性

          FF: Firefox, IE: Internet Explorer

              (1)    constructor 屬性返回對創(chuàng)建此對象的 Date 函數(shù)的引用。  

                      語法

                  object.constructor

                          

          實例

          在本例中,我們將展示如何使用 constructor 屬性:

           1<script type="text/javascript">
           2
           3var test=new Date();
           4
           5if (test.constructor==Array)
           6{
           7document.write("This is an Array");
           8}

           9if (test.constructor==Boolean)
          10{
          11document.write("This is a Boolean");
          12}

          13if (test.constructor==Date)
          14{
          15document.write("This is a Date");
          16}

          17if (test.constructor==String)
          18{
          19document.write("This is a String");
          20}

          21
          22</script>

              輸出:

              This is a Date


              
              (2)

          posted @ 2010-03-12 17:27 housen 閱讀(88) | 評論 (0)編輯 收藏

          僅列出標題  
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          導航

          統(tǒng)計

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          主站蜘蛛池模板: 赞皇县| 怀远县| 嵊泗县| 宽甸| 武乡县| 泰宁县| 利辛县| 康平县| 大新县| 沈阳市| 仙游县| 聂拉木县| 万荣县| 东平县| 大新县| 叶城县| 五常市| 红桥区| 乌鲁木齐县| 苏尼特右旗| 东山县| 金湖县| 澎湖县| 新平| 陆良县| 辰溪县| 南岸区| 准格尔旗| 晋中市| 亚东县| 桃源县| 宿州市| 军事| 湘潭县| 淮北市| 榆中县| 牡丹江市| 万山特区| 无锡市| 宣城市| 东莞市|