Date 对象用于处理日期和时间。
var myDate=new 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>
在本例中,我们将展示如何使用 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 阅读(85) 评论(0) 编辑 收藏
Powered by: BlogJava Copyright © housen