(function(){String.prototype.startsWith=function(C){return this.indexOf(C)===0};String.prototype.endsWith=function(C){var D=this.length-C.length;return D>0&&this.lastIndexOf(C)===D};String.prototype.contains=function(C){return !(this.indexOf(C)<0)};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/gi,"")};String.prototype.isNumber=function(){return !isNaN(this-0)};String.prototype.isEmpty=function(){return this.replace(/\s*/gi,"").length===0};window.StringBuilder=function(C){this.strings=[];if(typeof C=="string"){this.strings.push(C)}};StringBuilder.prototype.append=function(D){var C=this;C.strings.push(D);return C};StringBuilder.prototype.insert=function(D){var C=this;C.strings.unshift(D);return C};StringBuilder.prototype.toString=function(){return this.strings.join("")};StringBuilder.prototype.isEmpty=function(){return this.strings.length===0};window.addDOMLoadEvent=(function(){var H=[],C,G,E,D,F,I=function(){E=true;clearInterval(C);while((D=H.shift())){D()}if(G){G.onreadystatechange=null}};return function(J){if(E){return J()}if(!H[0]){if(document.addEventListener){document.addEventListener("DOMContentLoaded",I,false)}if(/WebKit/i.test(navigator.userAgent)){C=setInterval(function(){if(/loaded|complete/.test(document.readyState)){I()}},10)}F=window.onload;window.onload=function(){I();if(F){F()}}}H.push(J)}})();var B=document.createElement("div");if(!("swapNode" in B)){Node.prototype.swapNode=function(D){var E=this.nextSibling;var C=this.parentNode;D.parentNode.replaceChild(this,D);C.insertBefore(D,E)}}if(!("insertAdjacentHTML" in B)){HTMLElement.prototype.insertAdjacentElement=function(C,D){switch(C){case"beforeBegin":this.parentNode.insertBefore(D,this);break;case"afterBegin":this.insertBefore(D,this.firstChild);break;case"beforeEnd":this.appendChild(D);break;case"afterEnd":if(this.nextSibling){this.parentNode.insertBefore(D,this.nextSibling)}else{this.parentNode.appendChild(D)}break}};HTMLElement.prototype.insertAdjacentHTML=function(D,F){var E=this.ownerDocument.createRange();E.setStartBefore(this);var C=E.createContextualFragment(F);this.insertAdjacentElement(D,C)};HTMLElement.prototype.insertAdjacentText=function(D,E){var C=document.createTextNode(E);this.insertAdjacentElement(D,C)}}if(window.HTMLElement){HTMLElement.prototype.click=function(){var C=this.ownerDocument.createEvent("MouseEvents");C.initMouseEvent("click",true,true,this.ownerDocument.defaultView,1,0,0,0,0,false,false,false,false,0,null);this.dispatchEvent(C)};HTMLElement.prototype.__defineSetter__("innerText",function(D){var C=document.createTextNode(D);this.innerHTML=C;return C});HTMLElement.prototype.__defineGetter__("innerText",function(){var C=this.ownerDocument.createRange();C.selectNodeContents(this);return C.toString()})}var A=window.jaw=window.$=function(C,D){C=C||document;if(C.nodeType){return C}if(typeof C=="string"){return document.getElementById(C)}return undefined};A.removeClass=function(D,E){var C=D.className.match(" "+E)?" "+E:E;D.className=D.className.replace(C,"")};A.addClass=function(C,E){var D=new RegExp("(^|\\s)"+E+"(\\s|$)").test(C.className);if(!D){C.className+=C.className?" "+E:E}};A.addCssRule=function(C,H){var D="__dyStyle",G=$(D);if(!G){G=document.createElement("style");G.type="text/css";var F=document.getElementsByTagName("head")[0]||document.documentElement.firstChild;F.appendChild(G)}var I=G.sheet||G.styleSheet,E=0;if(A.browser.ie){E=I.rules.length;I.addRule(C,H,E)}else{E=I.cssRules.length;I.insertRule(C+"{"+H+"}",E)}};A.Elem={hide:function(D,C){if(D&&D.nodeType==1){if(C){D.style.visibility="hidden"}else{D.style.display="none"}}},show:function(D,C){if(D&&D.nodeType==1){if(C){D.style.visibility="visible"}else{D.style.display="block"}}}};A.extend=function(){var H=arguments[0]||{},F=1,G=arguments.length,C=false,E;if(H.constructor==Boolean){C=H;H=arguments[1]||{};F=2}if(typeof H!="object"&&typeof H!="function"){H={}}if(G==F){H=this;--F}for(;F<G;F++){if((E=arguments[F])!=null){for(var D in E){var I=H[D],J=E[D];if(H===J){continue}if(C&&J&&typeof J=="object"&&!J.nodeType){H[D]=A.extend(C,I||(J.length!=null?[]:{}),J)}else{if(J!==undefined){H[D]=J}}}}}return H};A.browser={ie:!!window.ActiveXObject,ie6:!!window.ActiveXObject&&!window.XMLHttpRequest,ie7:!!window.ActiveXObject&&!!window.XMLHttpRequest,firefox:!!document.getBoxObjectFor,opera:!!window.addEventStream,safari:/Apple/.test(navigator.vendor),chrome:!document.getBoxObjectFor&&!!window.MessageEvent};A.event={add:function(F,E,D,G){if(F.nodeType==3||F.nodeType==8){return }if(A.browser.ie&&F.setInterval){F=window}if(G!=undefined){var C=D;D=function(){return C.call(this,G)}}if(F.addEventListener){F.addEventListener(E,D,false)}else{if(F.attachEvent){F.attachEvent("on"+E,D)}}}};A.ajax=function(C){var H=null;if(C.dataType){H=C.dataType.toLowerCase()}var I=C.success&&typeof C.success=="function"?C.success:null;var D=C.cache?C.url:C.url+(C.url.match(/\?/)?"&":"?")+Math.random();if(H=="script"){var F=document.getElementsByTagName("head")[0]||document.documentElement.firstChild;var G=document.createElement("script");G.src=D;G.type="text/javascript";G.onload=G.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){if(I){I()}G.onload=G.onreadystatechange=null;G.parentNode.removeChild(G)}};F.appendChild(G);return undefined}C.method=C.method?C.method.toUpperCase():"GET";C.async=C.async==undefined?true:!!C.async;var J=A.browser.ie6?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();try{J.open(C.method,D,C.async);J.onreadystatechange=function(){if(J.readyState==4&&J.status==200){var M=J.getResponseHeader("content-type"),L=H=="xml"||!H&&M&&M.indexOf("xml")>=0,N=L?J.responseXML:J.responseText;if(I){I.call(this,N,C.argu)}J=null}};var K=null;if(C.method=="POST"){K=opt.sendData==undefined?null:opt.sendData}J.send(K)}catch(E){}};A.evalScript=function(C){return A.ajax({url:C.url,dataType:"script",success:C.success})};A.loadFlash=function(D){if(typeof D=="object"){if(D.border&&D.border.nodeType&&typeof D.params=="object"){var I=new StringBuilder();var G=D.params;var F=D.src;var H=D.id;if(A.browser.ie){I.append("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" id=\"").append(H).append("\" name=\"").append(H).append("\" width=\"").append(D.width).append("\" height=\"").append(D.height).append("\">");I.append("<param name=movie value=\"").append(F).append("\"/>");for(var C in G){var E=G[C];I.append("<param name=").append(C).append(" value=\"").append(E).append("\"/>")}I.append("</object>")}else{I.append("<embed src=\"").append(F).append("\" name=\"").append(H).append("\" id=\"").append(H).append("\" ").append("quality=\"high\" swliveconnect=\"true\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" allowScriptAccess=\"always\" ").append("type=\"application/x-shockwave-flash\" width=\"").append(D.width).append("\" height=\"").append(D.height).append("\" ");for(var C in G){var E=G[C];I.append(C).append("=\"").append(E).append("\" ")}I.append("></embed>")}D.border.innerHTML=I.toString()}}};A.loadCSS=function(C,F){var E=document.getElementsByTagName("head")[0]||document.documentElement.firstChild;if(typeof C=="string"){var D=$(F);if(D&&D.type=="text/css"){D.href=C}else{D=document.createElement("link");D.id=F;D.type="text/css";D.rel="stylesheet";D.href=C;E.appendChild(D)}}};A.uniqueArray=function(F){if(F&&F.constructor.toString()==Array){var C={},D=[];for(var E=0;E<F.length;E++){if(!C[F[E]]){C[F[E]]=true;D.push(F[E])}}return D}else{return[]}};A.getSWFObject=function(C){return A.browser.ie?$(C):document[C]};A.cookie={get:function(E){var D=E+"=";var C=document.cookie;if(C.length>0){begin=C.indexOf(D);if(begin!=-1){begin+=D.length;end=C.indexOf(";",begin);if(end==-1){end=C.length}return unescape(C.substring(begin,end))}}return null},set:function(E,J,F,K,G,C){var I=1*(60*60*1000);var D=365*24*I;var H=0.01667;if(F!=null){H=F}F=new Date();F.setTime(F.getTime()+(H*I));document.cookie=E+"="+escape(J)+((F==null)?"":"; expires="+F.toGMTString())+((K==null)?"":"; path="+K)+((G==null)?"":"; domain="+G)+((C==null)?"":"; secure")},del:function(E,G,F){var C=1*(60*60*1000);var D=new Date();D.setTime(D.getTime()-10000);if(this.get(E)){document.cookie=E+"="+((D==null)?"":"; expires="+D.toGMTString())+((G==null)?"":"; path="+G)+((F==null)?"":"; domain="+F)}}};A.getParameter=function(H,I){var D=window.location[I||"search"];D=D.replace(/^#|^\?/g,"");if(D){var F=D.split("&"),E=F.length;if(F&&E){for(var G=0;G<E;G++){var L=F[G],K=L.split("=");if(K.length==2){var C=K[0],J=K[1];if(H==C){return J}}}}}return undefined}})()
解决方案 »
- 分享初学JavaScript的好资源
- 高手帮忙看下,这段JS哪错,我感觉没错啊!!
- 网页UTF-8 GB2312编码 判断 ?
- 怎么用javascript对页面里的字段进行排序 (特别的着急)
- 如何让select中的某几项不能被选择?
- 怎样隐藏网易个人主页中的广告----属于嵌入<Script>语句。
- 为什么showModalDialog不能自动刷新,请大家帮我看看!!!
- 谁自己做过select控件,因为确省的select太讨厌,老是在所有层的上方!
- 如何让文本框输入数字和小数点,还有减号!谢谢
- ProgressBar控件怎么应用?
- javascript string 转换成 date类型
- 页面中有上下拉动的textbox叫什么控件
String.prototype.startsWith = function(C){
return this.indexOf(C) === 0
};
String.prototype.endsWith = function(C){
var D = this.length - C.length;
return D > 0 && this.lastIndexOf(C) === D
};
String.prototype.contains = function(C){
return !(this.indexOf(C) < 0)
};
String.prototype.trim = function(){
return this.replace(/^\s+|\s+$/gi, "")
};
String.prototype.isNumber = function(){
return !isNaN(this - 0)
};
String.prototype.isEmpty = function(){
return this.replace(/\s*/gi, "").length === 0
};
window.StringBuilder = function(C){
this.strings = [];
if (typeof C == "string") {
this.strings.push(C)
}
};
StringBuilder.prototype.append = function(D){
var C = this;
C.strings.push(D);
return C
};
StringBuilder.prototype.insert = function(D){
var C = this;
C.strings.unshift(D);
return C
};
StringBuilder.prototype.toString = function(){
return this.strings.join("")
};
StringBuilder.prototype.isEmpty = function(){
return this.strings.length === 0
};
window.addDOMLoadEvent = (function(){
var H = [], C, G, E, D, F, I = function(){
E = true;
clearInterval(C);
while ((D = H.shift())) {
D()
}
if (G) {
G.onreadystatechange = null
}
};
return function(J){
if (E) {
return J()
}
if (!H[0]) {
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", I, false)
}
if (/WebKit/i.test(navigator.userAgent)) {
C = setInterval(function(){
if (/loaded|complete/.test(document.readyState)) {
I()
}
}, 10)
}
F = window.onload;
window.onload = function(){
I();
if (F) {
F()
}
}
}
H.push(J)
}
})();
var B = document.createElement("div");
if (!("swapNode" in B)) {
Node.prototype.swapNode = function(D){
var E = this.nextSibling;
var C = this.parentNode;
D.parentNode.replaceChild(this, D);
C.insertBefore(D, E)
}
}
if (!("insertAdjacentHTML" in B)) {
HTMLElement.prototype.insertAdjacentElement = function(C, D){
switch (C) {
case "beforeBegin":
this.parentNode.insertBefore(D, this);
break;
case "afterBegin":
this.insertBefore(D, this.firstChild);
break;
case "beforeEnd":
this.appendChild(D);
break;
case "afterEnd":
if (this.nextSibling) {
this.parentNode.insertBefore(D, this.nextSibling)
} else {
this.parentNode.appendChild(D)
}
break
}
};
HTMLElement.prototype.insertAdjacentHTML = function(D, F){
var E = this.ownerDocument.createRange();
E.setStartBefore(this);
var C = E.createContextualFragment(F);
this.insertAdjacentElement(D, C)
};
HTMLElement.prototype.insertAdjacentText = function(D, E){
var C = document.createTextNode(E);
this.insertAdjacentElement(D, C)
}
}
if (window.HTMLElement) {
HTMLElement.prototype.click = function(){
var C = this.ownerDocument.createEvent("MouseEvents");
C.initMouseEvent("click", true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
this.dispatchEvent(C)
};
HTMLElement.prototype.__defineSetter__("innerText", function(D){
var C = document.createTextNode(D);
this.innerHTML = C;
return C
});
HTMLElement.prototype.__defineGetter__("innerText", function(){
var C = this.ownerDocument.createRange();
C.selectNodeContents(this);
return C.toString()
})
}
var A = window.jaw = window.$ = function(C, D){
C = C || document;
if (C.nodeType) {
return C
}
if (typeof C == "string") {
return document.getElementById(C)
}
return undefined
};
A.removeClass = function(D, E){
var C = D.className.match(" " + E) ? " " + E : E;
D.className = D.className.replace(C, "")
};
A.addClass = function(C, E){
var D = new RegExp("(^|\\s)" + E + "(\\s|$)").test(C.className);
if (!D) {
C.className += C.className ? " " + E : E
}
};
A.addCssRule = function(C, H){
var D = "__dyStyle", G = $(D);
if (!G) {
G = document.createElement("style");
G.type = "text/css";
var F = document.getElementsByTagName("head")[0] || document.documentElement.firstChild;
F.appendChild(G)
}
var I = G.sheet || G.styleSheet, E = 0;
if (A.browser.ie) {
E = I.rules.length;
I.addRule(C, H, E)
} else {
E = I.cssRules.length;
I.insertRule(C + "{" + H + "}", E)
}
};
A.Elem = {
hide: function(D, C){
if (D && D.nodeType == 1) {
if (C) {
D.style.visibility = "hidden"
} else {
D.style.display = "none"
}
}
},
show: function(D, C){
if (D && D.nodeType == 1) {
if (C) {
D.style.visibility = "visible"
} else {
D.style.display = "block"
}
}
}
};
A.extend = function(){
var H = arguments[0] ||
{}, F = 1, G = arguments.length, C = false, E;
if (H.constructor == Boolean) {
C = H;
H = arguments[1] ||
{};
F = 2
}
if (typeof H != "object" && typeof H != "function") {
H = {}
}
if (G == F) {
H = this;
--F
}
for (; F < G; F++) {
if ((E = arguments[F]) != null) {
for (var D in E) {
var I = H[D], J = E[D];
if (H === J) {
continue
}
if (C && J && typeof J == "object" && !J.nodeType) {
H[D] = A.extend(C, I || (J.length != null ? [] : {}), J)
} else {
if (J !== undefined) {
H[D] = J
}
}
}
}
}
return H
};
A.browser = {
ie: !!window.ActiveXObject,
ie6: !!window.ActiveXObject && !window.XMLHttpRequest,
ie7: !!window.ActiveXObject && !!window.XMLHttpRequest,
firefox: !!document.getBoxObjectFor,
opera: !!window.addEventStream,
safari: /Apple/.test(navigator.vendor),
chrome: !document.getBoxObjectFor && !!window.MessageEvent
};
A.event = {
add: function(F, E, D, G){
if (F.nodeType == 3 || F.nodeType == 8) {
return
}
if (A.browser.ie && F.setInterval) {
F = window
}
if (G != undefined) {
var C = D;
D = function(){
return C.call(this, G)
}
}
if (F.addEventListener) {
F.addEventListener(E, D, false)
} else {
if (F.attachEvent) {
F.attachEvent("on" + E, D)
}
}
}
};
A.ajax = function(C){
var H = null;
if (C.dataType) {
H = C.dataType.toLowerCase()
}
var I = C.success && typeof C.success == "function" ? C.success : null;
var D = C.cache ? C.url : C.url + (C.url.match(/\?/) ? "&" : "?") + Math.random();
if (H == "script") {
var F = document.getElementsByTagName("head")[0] || document.documentElement.firstChild;
var G = document.createElement("script");
G.src = D;
G.type = "text/javascript";
G.onload = G.onreadystatechange = function(){
if (!this.readyState || /loaded|complete/.test(this.readyState)) {
if (I) {
I()
}
G.onload = G.onreadystatechange = null;
G.parentNode.removeChild(G)
}
};
F.appendChild(G);
return undefined
}
C.method = C.method ? C.method.toUpperCase() : "GET";
C.async = C.async == undefined ? true : !!C.async;
var J = A.browser.ie6 ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
try {
J.open(C.method, D, C.async);
J.onreadystatechange = function(){
if (J.readyState == 4 && J.status == 200) {
var M = J.getResponseHeader("content-type"), L = H == "xml" || !H && M && M.indexOf("xml") >= 0, N = L ? J.responseXML : J.responseText;
if (I) {
I.call(this, N, C.argu)
}
J = null
}
};
var K = null;
if (C.method == "POST") {
K = opt.sendData == undefined ? null : opt.sendData
}
J.send(K)
} catch (E) {
}
};
A.evalScript = function(C){
return A.ajax({
url: C.url,
dataType: "script",
success: C.success
})
};
A.loadFlash = function(D){
if (typeof D == "object") {
if (D.border && D.border.nodeType && typeof D.params == "object") {
var I = new StringBuilder();
var G = D.params;
var F = D.src;
var H = D.id;
if (A.browser.ie) {
I.append(" <object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" id=\"").append(H).append("\" name=\"").append(H).append("\" width=\"").append(D.width).append("\" height=\"").append(D.height).append("\">");
I.append(" <param name=movie value=\"").append(F).append("\"/>");
for (var C in G) {
var E = G[C];
I.append(" <param name=").append(C).append(" value=\"").append(E).append("\"/>")
}
I.append(" </object>")
} else {
I.append(" <embed src=\"").append(F).append("\" name=\"").append(H).append("\" id=\"").append(H).append("\" ").append("quality=\"high\" swliveconnect=\"true\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" allowScriptAccess=\"always\" ").append("type=\"application/x-shockwave-flash\" width=\"").append(D.width).append("\" height=\"").append(D.height).append("\" ");
for (var C in G) {
var E = G[C];
I.append(C).append("=\"").append(E).append("\" ")
}
I.append("> </embed>")
}
D.border.innerHTML = I.toString()
}
}
};
A.loadCSS = function(C, F){
var E = document.getElementsByTagName("head")[0] || document.documentElement.firstChild;
if (typeof C == "string") {
var D = $(F);
if (D && D.type == "text/css") {
D.href = C
} else {
D = document.createElement("link");
D.id = F;
D.type = "text/css";
D.rel = "stylesheet";
D.href = C;
E.appendChild(D)
}
}
};
A.uniqueArray = function(F){
if (F && F.constructor.toString() == Array) {
var C = {}, D = [];
for (var E = 0; E < F.length; E++) {
if (!C[F[E]]) {
C[F[E]] = true;
D.push(F[E])
}
}
return D
} else {
return []
}
};
A.getSWFObject = function(C){
return A.browser.ie ? $(C) : document[C]
};
get: function(E){
var D = E + "=";
var C = document.cookie;
if (C.length > 0) {
begin = C.indexOf(D);
if (begin != -1) {
begin += D.length;
end = C.indexOf(";", begin);
if (end == -1) {
end = C.length
}
return unescape(C.substring(begin, end))
}
}
return null
},
set: function(E, J, F, K, G, C){
var I = 1 * (60 * 60 * 1000);
var D = 365 * 24 * I;
var H = 0.01667;
if (F != null) {
H = F
}
F = new Date();
F.setTime(F.getTime() + (H * I));
document.cookie = E + "=" + escape(J) + ((F == null) ? "" : "; expires=" + F.toGMTString()) + ((K == null) ? "" : "; path=" + K) + ((G == null) ? "" : "; domain=" + G) + ((C == null) ? "" : "; secure")
},
del: function(E, G, F){
var C = 1 * (60 * 60 * 1000);
var D = new Date();
D.setTime(D.getTime() - 10000);
if (this.get(E)) {
document.cookie = E + "=" + ((D == null) ? "" : "; expires=" + D.toGMTString()) + ((G == null) ? "" : "; path=" + G) + ((F == null) ? "" : "; domain=" + F)
}
}
};
A.getParameter = function(H, I){
var D = window.location[I || "search"];
D = D.replace(/^#|^\?/g, "");
if (D) {
var F = D.split("&"), E = F.length;
if (F && E) {
for (var G = 0; G < E; G++) {
var L = F[G], K = L.split("=");
if (K.length == 2) {
var C = K[0], J = K[1];
if (H == C) {
return J
}
}
}
}
}
return undefined
}
})()