JavaScript Date 對象參考手冊

          Date 對象

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

          創建 Date 對象的語法:

          var myDate=new Date()

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


          Date 對象屬性

          FF: Firefox, IE: Internet Explorer

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

                      語法

                  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 on 2010-03-12 17:27 housen 閱讀(88) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2010年3月>
          28123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          主站蜘蛛池模板: 美姑县| 琼结县| 杨浦区| 南城县| 吉安市| 抚州市| 渭源县| 岐山县| 满城县| 嘉荫县| 忻城县| 南皮县| 来宾市| 宽城| 桂东县| 嘉禾县| 象山县| 小金县| 宁蒗| 垦利县| 息烽县| 湘潭市| 綦江县| 南丰县| 蚌埠市| 永靖县| 黎平县| 汨罗市| 长垣县| 秦皇岛市| 宜兴市| 军事| 峨眉山市| 荣昌县| 奉贤区| 公安县| 冀州市| 公主岭市| 丹棱县| 关岭| 泽普县|