JavaScript懂的进!

来源:百度知道 编辑:UC知道 时间:2024/07/08 02:07:10
var feeDate = new Date($get("textbox1").value);
textbox1的值是"2008-08-08 0:00:00"
alert(feeDate);(NaN) 报错:类型不匹配!
我现在想要的结果是 把textbox1的值转成date类型的.帮忙

To sorry1254:
楼上的,javascript里面是弱对象类型,跟java是完全两码事,不要用java的认识来理解javascript,js里面只有一种类型,就是var,其他的所有类型或对象都是此类型上的衍生品,希望楼上理解。

=======================
请自己拆分字符串,这是javascript,不是java,这种格式js的date是不认识的

<script language="javascript">
var feeDate = new Date(2009,1,5,12,5);
alert(feeDate);
</script>

feeDate 是 一个 Object ,你去看一下Date的属性就明白了..

就跟你在JAVA中一下,直接System.out.println一个object打出来的是这个对象所在计算机中的内存地址!不知道这样说你明白不明白.

To create the Date object:
1. dateObjectName = new Date()
2. dateObjectName = new Date("day of the month, year, hour:minutes:seconds")
3. dateObjectName = new Date(year, month, day)
4. dateObjectName = new Date(year, month, day, hour, minutes, seconds)
dateObjectName is the name of a new object or the property of an existing object.
year, month, day, hour, minutes and seconds are character string values for points 1 and 2, while points 3 and 4 are