IE6 8中Date不支持toISOString的修复方法

前端小伙 10 0 PDF 2021-02-01 08:02:39

Date.prototype.toISOString方法是在ES5里添加的,ES3文档中没有,如下 这个方法在IE6/7/8中不支持,可按下面方式修复下 代码如下: if (!Date.prototype.toISOString) { Date.prototype.toISOString = function() { function pad(n) { return n < 10 ? ‘0’ + n : n } return this.getUTCFullYear() + ‘-‘ + pad(this.getUTCMonth() + 1) + ‘-‘ + pad(this.getUT

用户评论
请输入评论内容
评分:
暂无评论