打印本文 打印本文 关闭窗口 关闭窗口
兼容低版本 IE 的 JScript 5.5 实现
作者:武汉SEO闵涛  文章来源:敏韬网  点击数3769  更新时间:2009/4/23 11:27:39  文章录入:mintao  责任编辑:mintao
;  for (var i = 0; i < returnValue.length - deleteCount; i++) {
        this[start + len + i] = returnValue[deleteCount + i];
    }
    this.length = start + len + returnValue.length - deleteCount;
    returnValue.length = deleteCount;
    return returnValue;
}
 
Function.prototype.apply = function (o, p) {
    var ps = [];
    if (typeof(o) == "undefined") {
        var __$$apply$$__ = this;
        return eval('__$$apply$$__(' + ps.join(', ') + ');');
    }
    if (p) {
        if (typeof(p[0]) == "undefined") {
            @if (@_jscript_version < 5)
                return null;
            @else
                var e = new Error(-2146823260, "Array or arguments object expected");
                e.name = "TypeError";
                e.message = e.description;
                throw(e);
            @end
        }
        for (var i = 0; i < p.length; i++) {
            ps[i] = 'p[' + i + ']';
        }
    }
    if ((typeof(o) == "object") || (typeof(o) == "function")) {
        o.__$$apply$$__ = this;
        var returnValue = eval('o.__$$apply$$__(' + ps.join(', ') + ');');
        o.__$$apply$$__ = null;
        return returnValue;
    }
    else {
        this.__$$apply$$__ = this;
        var returnValue = eval('this.__$$apply$$__(' + ps.join(', ') + ');');
        this.__$$apply$$__ = null;
        return returnValue;
    }
}
 
Function.prototype.call = function (o) {
    var ps = [];
    if (typeof(o) == "undefined") {
        var __$$call$$__ = this;
        return eval('__$$call$$__(' + ps.join(', ') + ');');
    }
    if (arguments.length > 1) {
        for (var i = 1; i < arguments.length; i++) {
            ps[i - 1] = 'arguments[' + i + ']';
        }
    }
    if ((typeof(o) == "object") || (typeof(o) == "function")) {
        o.__$$call$$__ = this;
        var returnValue = eval('o.__$$call$$__(' + ps.join(', ') + ');');
        o.__$$call$$__ = null;
        return returnValue;
    }
    else {
        this.__$$call$$__ = this;
        var returnValue = eval('this.__$$call$$__(' + ps.join(', ') + ');');
        this.__$$call$$__ = null;
        return returnValue;
    }
}
 
@end @*/

上一页  [1] [2] [3] [4] [5] 

打印本文 打印本文 关闭窗口 关闭窗口