读书人

jquery中的函数index和自定义的冲突如

发布时间: 2012-09-23 10:28:11 作者: rapoo

jquery中的函数index和自定义的冲突怎么解决呢??

JScript code
(function() {    var l = this,    g, y = l.jQuery,    p = l.$,    o = l.jQuery = l.$ = function(E, F) {        return new o.fn.init(E, F)    },    D = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,    f = /^.[^:#\[\.,]*$/;    o.fn = o.prototype = {        init: function(E, H) {            E = E || document;            if (E.nodeType) {                this[0] = E;                this.length = 1;                this.context = E;                return this            }            if (typeof E === "string") {                var G = D.exec(E);                if (G && (G[1] || !H)) {                    if (G[1]) {                        E = o.clean([G[1]], H)                    } else {                        var I = document.getElementById(G[3]);                        if (I && I.id != G[3]) {                            return o().find(E)                        }                        var F = o(I || []);                        F.context = document;                        F.selector = E;                        return F                    }                } else {                    return o(H).find(E)                }            } else {                if (o.isFunction(E)) {                    return o(document).ready(E)                }            }            if (E.selector && E.context) {                this.selector = E.selector;                this.context = E.context            }            return this.setArray(o.isArray(E) ? E: o.makeArray(E))        },        selector: "",        jquery: "1.3.2",        size: function() {            return this.length        },        get: function(E) {            return E === g ? Array.prototype.slice.call(this) : this[E]        },        pushStack: function(F, H, E) {            var G = o(F);            G.prevObject = this;            G.context = this.context;            if (H === "find") {                G.selector = this.selector + (this.selector ? " ": "") + E            } else {                if (H) {                    G.selector = this.selector + "." + H + "(" + E + ")"                }            }            return G        },        setArray: function(E) {            this.length = 0;            Array.prototype.push.apply(this, E);            return this        },        each: function(F, E) {            return o.each(this, F, E)        },        index: function(E) {            return o.inArray(E && E.jquery ? E[0] : E, this)        },         };下面是一些其他的})();


这个里面的index() 冲突,我要怎么解决呢?我把这个改成 Index也不行
报错
TypeError: $(this).index is not a function


[解决办法]
你光贴jquery,又不贴自己的,让我们怎么看呀?

读书人网 >JavaScript

热点推荐