首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

和Jquery冲突的代码,

2012-09-06 
和Jquery冲突的代码,求助!急急急这段代码和JQUERY冲突,请问那个前辈可以修改一下!或提供一下解决办法。JScr

和Jquery冲突的代码,求助!急急急
这段代码和JQUERY冲突,请问那个前辈可以修改一下!或提供一下解决办法。

JScript code
var Abstract = new Object();Object.prototype.extend1 = function(object) {  for (property in object) {    this[property] = object[property];  }  return this;}Function.prototype.bind1 = function(object) {  var method = this;  return function() {    method.apply(object, arguments);  }}Function.prototype.bindAsEventListener = function(object) {  var method = this;  return function(event) {    method.call(object, event || window.event);  }}var Try = {  these: function() {    var returnValue;        for (var i = 0; i < arguments.length; i++) {      var lambda = arguments[i];      try {        returnValue = lambda();        break;      } catch (e) {}    }        return returnValue;  }}/*--------------------------------------*/var PeriodicalExecuter = Class.create();PeriodicalExecuter.prototype = {  initialize: function(callback, frequency) {    this.callback = callback;    this.frequency = frequency;    this.currentlyExecuting = false;        this.registerCallback();  },    registerCallback: function() {    setTimeout(this.onTimerEvent.bind1(this), this.frequency * 1000);  },    onTimerEvent: function() {    if (!this.currentlyExecuting) {      try {         this.currentlyExecuting = true;        this.callback();       } finally {         this.currentlyExecuting = false;      }    }        this.registerCallback();  }}//--------------------------------------string-----------------------------------------String.prototype.lTrim = function () {return this.replace(/^\s*/, "");}String.prototype.rTrim = function () {return this.replace(/\s*$/, "");}String.prototype.trim = function () {return this.rTrim().lTrim();}String.prototype.endsWith = function(sEnd) {return (this.substr(this.length-sEnd.length)==sEnd);}String.prototype.startsWith = function(sStart) {return (this.substr(0,sStart.length)==sStart);}String.prototype.format = function(){ var s = this; for (var i=0; i < arguments.length; i++){ s = s.replace("{" + (i) + "}", arguments[i]);}return(s);}String.prototype.removeSpaces = function(){ return this.replace(/ /gi,'');}String.prototype.removeExtraSpaces = function(){ return(this.replace(String.prototype.removeExtraSpaces.re, " "));}String.prototype.removeExtraSpaces.re = new RegExp("\\s+", "g"); String.prototype.removeSpaceDelimitedString = function(r){ var s = " " + this.trim() + " "; return s.replace(" " + r,"").rTrim();}String.prototype.isEmpty = function() {return this.length==0;}; String.prototype.validateURL = function(){ var urlRegX = /[^a-zA-Z0-9-]/g; return sURL.match(urlRegX, "");}String.prototype.isEmail = function(){ var emailReg = /^\w+([-.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; return emailReg.test(this);}String.prototype.isAlphaNumeric = function(){ var alphaReg = /[^a-zA-Z0-9]/g; return !alphaReg.test(this);}String.prototype.encodeURI = function(){ var returnString; returnString = escape( this )returnString = returnString.replace(/\+/g,"%2B"); return returnString}String.prototype.decodeURI = function() {return unescape(this)}//--------------------------------------Array-----------------------------------------Array.prototype.indexOf = function(p_var){     for (var i=0; i<this.length; i++)    {         if (this[i] == p_var)        {             return(i);        }    }    return(-1);}Array.prototype.exists = function(p_var) {return(this.indexOf(p_var) != -1);}Array.prototype.queue = function(p_var) {this.push(p_var)}Array.prototype.dequeue = function() {return(this.shift());}Array.prototype.removeAt = function(p_iIndex) {return this.splice(p_iIndex, 1);}Array.prototype.remove = function(o){     var i = this.indexOf(o); if (i>-1) this.splice(i,1); return (i>-1)}Array.prototype.clear = function(){     var iLength = this.length;     for (var i=0; i < iLength; i++)    {         this.shift();    }}Array.prototype.addArray = function(p_a){     if (p_a)    {         for (var i=0; i < p_a.length; i++)        {             this.push(p_a[i]);        }    }} 



[解决办法]
哪里冲突了,你的脚本在浏览器跑起来报什么错了?
[解决办法]
for (property in object) {
this[property] = object[property];
}
楼主,jquery是用each语法的,至于具体怎么使用,
您可以到www.jquery.com进行查询

[解决办法]
和prototype中的属性和jquery中的相命名了所以会出错

热点排行
Bad Request.