咖啡伴侣

呆在上海
posts - 163, comments - 156, trackbacks - 0, articles - 2

IE下js无法继承toString方法

Posted on 2009-07-06 13:50 oathleo 阅读(1244) 评论(0)  编辑  收藏 所属分类: Web
override: function(origclass, overrides){
            if (overrides) {
                var p = origclass.prototype;
                for (var method in overrides) {
                //IE下无法遍历到
               //"toString", "toLocaleString", "valueOf",
               //"hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable"这几个方法


                    p[method] = overrides[method];
                }
                if (TWaver.isIE) {  //IE 问题,目前只有'toString'用到,先处理
                    if (p['toString'] != overrides['toString']) {
                        p['toString'] = overrides['toString'];
                    }
                }
            }
        }


只有注册用户登录后才能发表评论。


网站导航: