date.prototype.toisostring方法是在es5里添加的,es3文档中没有,如下
这个方法在ie6/7/8中不支持,可按下面方式修复下
复制代码 代码如下:
if (!date.prototype.toisostring) {
date.prototype.toisostring = function() {
function pad(n) { return n return this.getutcfullyear() + '-'
+ pad(this.getutcmonth() + 1) + '-'
+ pad(this.getutcdate()) + 't'
+ pad(this.getutchours()) + ':'
+ pad(this.getutcminutes()) + ':'
+ pad(this.getutcseconds()) + '.'
+ pad(this.getutcmilliseconds()) + 'z';
}
}
相关:
http://msdn.microsoft.com/zh-cn/library/ie/ff925953%28v=vs.94%29.aspx
https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/date