手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jQuery 1.0.2
jQuery 1.0.2
摘要:复制代码代码如下:/*preventexecutionofjQueryifincludedmorethenonce*/if(typeofwi...

复制代码 代码如下:

/*preventexecutionofjQueryifincludedmorethenonce*/

if(typeofwindow.jQuery=="undefined"){

/*

*jQuery1.0.2-NewWaveJavascript

*

*Copyright(c)2006JohnResig(jquery.com)

*DuallicensedundertheMIT(MIT-LICENSE.txt)

*andGPL(GPL-LICENSE.txt)licenses.

*

*$Date:2006-10-0920:23:18-0400(Mon,09Oct2006)$

*$Rev:413$

*/

//Globalundefinedvariable

window.undefined=window.undefined;

jQuery=function(a,c){

//Shortcutfordocumentready(because$(document).each()issilly)

if(a&&typeofa=="function"&&jQuery.fn.ready)

returnjQuery(document).ready(a);

//Makesurethataselectionwasprovided

a=a||jQuery.context||document;

//WatchforwhenajQueryobjectispassedastheselector

if(a.jquery)

returnjQuery(jQuery.merge(a,[]));

//WatchforwhenajQueryobjectispassedatthecontext

if(c&&c.jquery)

returnjQuery(c).find(a);

//Ifthecontextisglobal,returnanewobject

if(window==this)

returnnewjQuery(a,c);

//HandleHTMLstrings

varm=/^[^<]*(<.+>)[^>]*$/.exec(a);

if(m)a=jQuery.clean([m[1]]);

//Watchforwhenanarrayispassedin

this.get(a.constructor==Array||a.length&&!a.nodeType&&a[0]!=undefined&&a[0].nodeType?

//AssumethatitisanarrayofDOMElements

jQuery.merge(a,[]):

//Findthematchingelementsandsavethemforlater

jQuery.find(a,c));

//Seeifanextrafunctionwasprovided

varfn=arguments[arguments.length-1];

//Ifso,executeitincontext

if(fn&&typeoffn=="function")

this.each(fn);

};

//Mapoverthe$incaseofoverwrite

if(typeof$!="undefined")

jQuery._$=$;

//MapthejQuerynamespacetothe'$'one

var$=jQuery;

jQuery.fn=jQuery.prototype={

jquery:"1.0.2",

size:function(){

returnthis.length;

},

get:function(num){

//Watchforwhenanarray(ofelements)ispassedin

if(num&&num.constructor==Array){

//UseatrickyhacktomakethejQueryobject

//lookandfeellikeanarray

this.length=0;

[].push.apply(this,num);

returnthis;

}else

returnnum==undefined?

//Returna'clean'array

jQuery.merge(this,[]):

//Returnjusttheobject

this[num];

},

each:function(fn,args){

returnjQuery.each(this,fn,args);

},

index:function(obj){

varpos=-1;

this.each(function(i){

if(this==obj)pos=i;

});

returnpos;

},

attr:function(key,value,type){

//Checktoseeifwe'resettingstylevalues

returnkey.constructor!=String||value!=undefined?

this.each(function(){

//Seeifwe'resettingahashofstyles

if(value==undefined)

//Setallthestyles

for(varpropinkey)

jQuery.attr(

type?this.style:this,

prop,key[prop]

);

//Seeifwe'resettingasinglekey/valuestyle

else

jQuery.attr(

type?this.style:this,

key,value

);

}):

//Lookforthecasewherewe'reaccessingastylevalue

jQuery[type||"attr"](this[0],key);

},

css:function(key,value){

returnthis.attr(key,value,"curCSS");

},

text:function(e){

e=e||this;

vart="";

for(varj=0;j<e.length;j++){

varr=e[j].childNodes;

for(vari=0;i<r.length;i++)

if(r[i].nodeType!=8)

t+=r[i].nodeType!=1?

r[i].nodeValue:jQuery.fn.text([r[i]]);

}

returnt;

},

wrap:function(){

//Theelementstowrapthetargetaround

vara=jQuery.clean(arguments);

//Wrapeachofthematchedelementsindividually

returnthis.each(function(){

//Clonethestructurethatwe'reusingtowrap

varb=a[0].cloneNode(true);

//Insertitbeforetheelementtobewrapped

this.parentNode.insertBefore(b,this);

//Findthedeepestpointinthewrapstructure

while(b.firstChild)

b=b.firstChild;

//Movethematchedelementtowithinthewrapstructure

b.appendChild(this);

});

},

append:function(){

returnthis.domManip(arguments,true,1,function(a){

this.appendChild(a);

});

},

prepend:function(){

returnthis.domManip(arguments,true,-1,function(a){

this.insertBefore(a,this.firstChild);

});

},

before:function(){

returnthis.domManip(arguments,false,1,function(a){

this.parentNode.insertBefore(a,this);

});

},

after:function(){

returnthis.domManip(arguments,false,-1,function(a){

this.parentNode.insertBefore(a,this.nextSibling);

});

},

end:function(){

returnthis.get(this.stack.pop());

},

find:function(t){

returnthis.pushStack(jQuery.map(this,function(a){

returnjQuery.find(t,a);

}),arguments);

},

clone:function(deep){

returnthis.pushStack(jQuery.map(this,function(a){

returna.cloneNode(deep!=undefined?deep:true);

}),arguments);

},

filter:function(t){

returnthis.pushStack(

t.constructor==Array&&

jQuery.map(this,function(a){

for(vari=0;i<t.length;i++)

if(jQuery.filter(t[i],[a]).r.length)

returna;

})||

t.constructor==Boolean&&

(t?this.get():[])||

typeoft=="function"&&

jQuery.grep(this,t)||

jQuery.filter(t,this).r,arguments);

},

not:function(t){

returnthis.pushStack(t.constructor==String?

jQuery.filter(t,this,false).r:

jQuery.grep(this,function(a){returna!=t;}),arguments);

},

add:function(t){

returnthis.pushStack(jQuery.merge(this,t.constructor==String?

jQuery.find(t):t.constructor==Array?t:[t]),arguments);

},

is:function(expr){

returnexpr?jQuery.filter(expr,this).r.length>0:false;

},

domManip:function(args,table,dir,fn){

varclone=this.size()>1;

vara=jQuery.clean(args);

returnthis.each(function(){

varobj=this;

if(table&&this.nodeName.toUpperCase()=="TABLE"&&a[0].nodeName.toUpperCase()!="THEAD"){

vartbody=this.getElementsByTagName("tbody");

if(!tbody.length){

obj=document.createElement("tbody");

this.appendChild(obj);

}else

obj=tbody[0];

}

for(vari=(dir<0?a.length-1:0);

i!=(dir<0?dir:a.length);i+=dir){

fn.apply(obj,[clone?a[i].cloneNode(true):a[i]]);

}

});

},

pushStack:function(a,args){

varfn=args&&args[args.length-1];

varfn2=args&&args[args.length-2];

if(fn&&fn.constructor!=Function)fn=null;

if(fn2&&fn2.constructor!=Function)fn2=null;

if(!fn){

if(!this.stack)this.stack=[];

this.stack.push(this.get());

this.get(a);

}else{

varold=this.get();

this.get(a);

if(fn2&&a.length||!fn2)

this.each(fn2||fn).get(old);

else

this.get(old).each(fn);

}

returnthis;

}

};

jQuery.extend=jQuery.fn.extend=function(obj,prop){

if(!prop){prop=obj;obj=this;}

for(variinprop)obj[i]=prop[i];

returnobj;

};

jQuery.extend({

init:function(){

jQuery.initDone=true;

jQuery.each(jQuery.macros.axis,function(i,n){

jQuery.fn[i]=function(a){

varret=jQuery.map(this,n);

if(a&&a.constructor==String)

ret=jQuery.filter(a,ret).r;

returnthis.pushStack(ret,arguments);

};

});

jQuery.each(jQuery.macros.to,function(i,n){

jQuery.fn[i]=function(){

vara=arguments;

returnthis.each(function(){

for(varj=0;j<a.length;j++)

jQuery(a[j])[n](this);

});

};

});

jQuery.each(jQuery.macros.each,function(i,n){

jQuery.fn[i]=function(){

returnthis.each(n,arguments);

};

});

jQuery.each(jQuery.macros.filter,function(i,n){

jQuery.fn[n]=function(num,fn){

returnthis.filter(":"+n+"("+num+")",fn);

};

});

jQuery.each(jQuery.macros.attr,function(i,n){

n=n||i;

jQuery.fn[i]=function(h){

returnh==undefined?

this.length?this[0][n]:null:

this.attr(n,h);

};

});

jQuery.each(jQuery.macros.css,function(i,n){

jQuery.fn[n]=function(h){

returnh==undefined?

(this.length?jQuery.css(this[0],n):null):

this.css(n,h);

};

});

},

each:function(obj,fn,args){

if(obj.length==undefined)

for(variinobj)

fn.apply(obj[i],args||[i,obj[i]]);

else

for(vari=0;i<obj.length;i++)

fn.apply(obj[i],args||[i,obj[i]]);

returnobj;

},

className:{

add:function(o,c){

if(jQuery.className.has(o,c))return;

o.className+=(o.className?"":"")+c;

},

remove:function(o,c){

if(!c){

o.className="";

}else{

varclasses=o.className.split("");

for(vari=0;i<classes.length;i++){

if(classes[i]==c){

classes.splice(i,1);

break;

}

}

o.className=classes.join('');

}

},

has:function(e,a){

if(e.className!=undefined)

e=e.className;

returnnewRegExp("(^|s)"+a+"(s|$)").test(e);

}

},

swap:function(e,o,f){

for(variino){

e.style["old"+i]=e.style[i];

e.style[i]=o[i];

}

f.apply(e,[]);

for(variino)

e.style[i]=e.style["old"+i];

},

css:function(e,p){

if(p=="height"||p=="width"){

varold={},oHeight,oWidth,d=["Top","Bottom","Right","Left"];

for(variind){

old["padding"+d[i]]=0;

old["border"+d[i]+"Width"]=0;

}

jQuery.swap(e,old,function(){

if(jQuery.css(e,"display")!="none"){

oHeight=e.offsetHeight;

oWidth=e.offsetWidth;

}else{

e=jQuery(e.cloneNode(true)).css({

visibility:"hidden",position:"absolute",display:"block",right:"0",left:"0"

}).appendTo(e.parentNode)[0];

varparPos=jQuery.css(e.parentNode,"position");

if(parPos==""||parPos=="static")

e.parentNode.style.position="relative";

oHeight=e.clientHeight;

oWidth=e.clientWidth;

if(parPos==""||parPos=="static")

e.parentNode.style.position="static";

e.parentNode.removeChild(e);

}

});

returnp=="height"?oHeight:oWidth;

}

returnjQuery.curCSS(e,p);

},

curCSS:function(elem,prop,force){

varret;

if(prop=='opacity'&&jQuery.browser.msie)

returnjQuery.attr(elem.style,'opacity');

if(!force&&elem.style[prop]){

ret=elem.style[prop];

}elseif(elem.currentStyle){

varnewProp=prop.replace(/-(w)/g,function(m,c){returnc.toUpperCase();});

ret=elem.currentStyle[prop]||elem.currentStyle[newProp];

}elseif(document.defaultView&&document.defaultView.getComputedStyle){

prop=prop.replace(/([A-Z])/g,"-$1").toLowerCase();

varcur=document.defaultView.getComputedStyle(elem,null);

if(cur)

ret=cur.getPropertyValue(prop);

elseif(prop=='display')

ret='none';

else

jQuery.swap(elem,{display:'block'},function(){

ret=document.defaultView.getComputedStyle(this,null).getPropertyValue(prop);

});

}

returnret;

},

clean:function(a){

varr=[];

for(vari=0;i<a.length;i++){

if(a[i].constructor==String){

//trimwhitespace,otherwiseindexOfwon'tworkasexpected

a[i]=jQuery.trim(a[i]);

vartable="";

if(!a[i].indexOf("<thead")||!a[i].indexOf("<tbody")){

table="thead";

a[i]="<table>"+a[i]+"</table>";

}elseif(!a[i].indexOf("<tr")){

table="tr";

a[i]="<table>"+a[i]+"</table>";

}elseif(!a[i].indexOf("<td")||!a[i].indexOf("<th")){

table="td";

a[i]="<table><tbody><tr>"+a[i]+"</tr></tbody></table>";

}

vardiv=document.createElement("div");

div.innerHTML=a[i];

if(table){

div=div.firstChild;

if(table!="thead")div=div.firstChild;

if(table=="td")div=div.firstChild;

}

for(varj=0;j<div.childNodes.length;j++)

r.push(div.childNodes[j]);

}elseif(a[i].jquery||a[i].length&&!a[i].nodeType)

for(vark=0;k<a[i].length;k++)

r.push(a[i][k]);

elseif(a[i]!==null)

r.push(a[i].nodeType?a[i]:document.createTextNode(a[i].toString()));

}

returnr;

},

expr:{

"":"m[2]=='*'||a.nodeName.toUpperCase()==m[2].toUpperCase()",

"#":"a.getAttribute('id')&&a.getAttribute('id')==m[2]",

":":{

//PositionChecks

lt:"i<m[3]-0",

gt:"i>m[3]-0",

nth:"m[3]-0==i",

eq:"m[3]-0==i",

first:"i==0",

last:"i==r.length-1",

even:"i%2==0",

odd:"i%2",

//ChildChecks

"nth-child":"jQuery.sibling(a,m[3]).cur",

"first-child":"jQuery.sibling(a,0).cur",

"last-child":"jQuery.sibling(a,0).last",

"only-child":"jQuery.sibling(a).length==1",

//ParentChecks

parent:"a.childNodes.length",

empty:"!a.childNodes.length",

//TextCheck

contains:"(a.innerText||a.innerHTML).indexOf(m[3])>=0",

//Visibility

visible:"a.type!='hidden'&&jQuery.css(a,'display')!='none'&&jQuery.css(a,'visibility')!='hidden'",

hidden:"a.type=='hidden'||jQuery.css(a,'display')=='none'||jQuery.css(a,'visibility')=='hidden'",

//Formattributes

enabled:"!a.disabled",

disabled:"a.disabled",

checked:"a.checked",

selected:"a.selected||jQuery.attr(a,'selected')",

//Formelements

text:"a.type=='text'",

radio:"a.type=='radio'",

checkbox:"a.type=='checkbox'",

file:"a.type=='file'",

password:"a.type=='password'",

submit:"a.type=='submit'",

image:"a.type=='image'",

reset:"a.type=='reset'",

button:"a.type=='button'",

input:"a.nodeName.toLowerCase().match(/input|select|textarea|button/)"

},

".":"jQuery.className.has(a,m[2])",

"@":{

"=":"z==m[4]",

"!=":"z!=m[4]",

"^=":"z&&!z.indexOf(m[4])",

"$=":"z&&z.substr(z.length-m[4].length,m[4].length)==m[4]",

"*=":"z&&z.indexOf(m[4])>=0",

"":"z"

},

"[":"jQuery.find(m[2],a).length"

},

token:[

"..|/..","a.parentNode",

">|/","jQuery.sibling(a.firstChild)",

"+","jQuery.sibling(a).next",

"~",function(a){

varr=[];

vars=jQuery.sibling(a);

if(s.n>0)

for(vari=s.n;i<s.length;i++)

r.push(s[i]);

returnr;

}

],

find:function(t,context){

//MakesurethatthecontextisaDOMElement

if(context&&context.nodeType==undefined)

context=null;

//Setthecorrectcontext(ifnoneisprovided)

context=context||jQuery.context||document;

if(t.constructor!=String)return[t];

if(!t.indexOf("//")){

context=context.documentElement;

t=t.substr(2,t.length);

}elseif(!t.indexOf("/")){

context=context.documentElement;

t=t.substr(1,t.length);

//FIXAssumetherootelementisright:(

if(t.indexOf("/")>=1)

t=t.substr(t.indexOf("/"),t.length);

}

varret=[context];

vardone=[];

varlast=null;

while(t.length>0&&last!=t){

varr=[];

last=t;

t=jQuery.trim(t).replace(/^///i,"");

varfoundToken=false;

for(vari=0;i<jQuery.token.length;i+=2){

if(foundToken)continue;

varre=newRegExp("^("+jQuery.token[i]+")");

varm=re.exec(t);

if(m){

r=ret=jQuery.map(ret,jQuery.token[i+1]);

t=jQuery.trim(t.replace(re,""));

foundToken=true;

}

}

if(!foundToken){

if(!t.indexOf(",")||!t.indexOf("|")){

if(ret[0]==context)ret.shift();

done=jQuery.merge(done,ret);

r=ret=[context];

t=""+t.substr(1,t.length);

}else{

varre2=/^([#.]?)([a-z0-9*_-]*)/i;

varm=re2.exec(t);

if(m[1]=="#"){

//Ummm,shouldmakethisworkinallXMLdocs

varoid=document.getElementById(m[2]);

r=ret=oid?[oid]:[];

t=t.replace(re2,"");

}else{

if(!m[2]||m[1]==".")m[2]="*";

for(vari=0;i<ret.length;i++)

r=jQuery.merge(r,

m[2]=="*"?

jQuery.getAll(ret[i]):

ret[i].getElementsByTagName(m[2])

);

}

}

}

if(t){

varval=jQuery.filter(t,r);

ret=r=val.r;

t=jQuery.trim(val.t);

}

}

if(ret&&ret[0]==context)ret.shift();

done=jQuery.merge(done,ret);

returndone;

},

getAll:function(o,r){

r=r||[];

vars=o.childNodes;

for(vari=0;i<s.length;i++)

if(s[i].nodeType==1){

r.push(s[i]);

jQuery.getAll(s[i],r);

}

returnr;

},

attr:function(elem,name,value){

varfix={

"for":"htmlFor",

"class":"className",

"float":"cssFloat",

innerHTML:"innerHTML",

className:"className",

value:"value",

disabled:"disabled",

checked:"checked"

};

//IEactuallyusesfiltersforopacity...elemisactuallyelem.style

if(name=="opacity"&&jQuery.browser.msie&&value!=undefined){

//IEhastroublewithopacityifitdoesnothavelayout

//Wouldprefertocheckelement.hasLayoutfirstbutdon'thaveaccesstotheelementhere

elem['zoom']=1;

if(value==1)//RemovefiltertoavoidmoreIEweirdness

returnelem["filter"]=elem["filter"].replace(/alpha([^)]*)/gi,"");

else

returnelem["filter"]=elem["filter"].replace(/alpha([^)]*)/gi,"")+"alpha(opacity="+value*100+")";

}elseif(name=="opacity"&&jQuery.browser.msie){

returnelem["filter"]?parseFloat(elem["filter"].match(/alpha(opacity=(.*))/)[1])/100:1;

}

//Mozilladoesn'tplaywellwithopacity1

if(name=="opacity"&&jQuery.browser.mozilla&&value==1)value=0.9999;

if(fix[name]){

if(value!=undefined)elem[fix[name]]=value;

returnelem[fix[name]];

}elseif(value==undefined&&jQuery.browser.msie&&elem.nodeName&&elem.nodeName.toUpperCase()=='FORM'&&(name=='action'||name=='method')){

returnelem.getAttributeNode(name).nodeValue;

}elseif(elem.getAttribute!=undefined){

if(value!=undefined)elem.setAttribute(name,value);

returnelem.getAttribute(name,2);

}else{

name=name.replace(/-([a-z])/ig,function(z,b){returnb.toUpperCase();});

if(value!=undefined)elem[name]=value;

returnelem[name];

}

},

//Theregularexpressionsthatpowertheparsingengine

parse:[

//Match:[@value='test'],[@foo]

"[*(@)S*([!*$^=]*)*('?"?)(.*?)4*]",

//Match:[div],[divp]

"([)s*(.*?)s*]",

//Match::contains('foo')

"(:)S("?'?([^)]*?)"?'?)",

//Match::even,:last-chlid

"([:.#]*)S"

],

filter:function(t,r,not){

//Figureoutifwe'redoingregular,orinverse,filtering

varg=not!==false?jQuery.grep:

function(a,f){returnjQuery.grep(a,f,true);};

while(t&&/^[a-z[({<*:.#]/i.test(t)){

varp=jQuery.parse;

for(vari=0;i<p.length;i++){

//Lookfor,andreplace,string-likesequences

//andfinallybuildaregexpoutofit

varre=newRegExp(

"^"+p[i].replace("S","([a-z*_-][a-z0-9_-]*)"),"i");

varm=re.exec(t);

if(m){

//Re-organizethefirstmatch

if(!i)

m=["",m[1],m[3],m[2],m[5]];

//Removewhatwejustmatched

t=t.replace(re,"");

break;

}

}

//:not()isaspecialcasethatcanbeoptimizedby

//keepingitoutoftheexpressionlist

if(m[1]==":"&&m[2]=="not")

r=jQuery.filter(m[3],r,false).r;

//Otherwise,findtheexpressiontoexecute

else{

varf=jQuery.expr[m[1]];

if(f.constructor!=String)

f=jQuery.expr[m[1]][m[2]];

//Buildacustommacrotoencloseit

eval("f=function(a,i){"+

(m[1]=="@"?"z=jQuery.attr(a,m[3]);":"")+

"return"+f+"}");

//Executeitagainstthecurrentfilter

r=g(r,f);

}

}

//Returnanarrayoffilteredelements(r)

//andthemodifiedexpressionstring(t)

return{r:r,t:t};

},

trim:function(t){

returnt.replace(/^s+|s+$/g,"");

},

parents:function(elem){

varmatched=[];

varcur=elem.parentNode;

while(cur&&cur!=document){

matched.push(cur);

cur=cur.parentNode;

}

returnmatched;

},

sibling:function(elem,pos,not){

varelems=[];

if(elem){

varsiblings=elem.parentNode.childNodes;

for(vari=0;i<siblings.length;i++){

if(not===true&&siblings[i]==elem)continue;

if(siblings[i].nodeType==1)

elems.push(siblings[i]);

if(siblings[i]==elem)

elems.n=elems.length-1;

}

}

returnjQuery.extend(elems,{

last:elems.n==elems.length-1,

cur:pos=="even"&&elems.n%2==0||pos=="odd"&&elems.n%2||elems[pos]==elem,

prev:elems[elems.n-1],

next:elems[elems.n+1]

});

},

merge:function(first,second){

varresult=[];

//Movebovertothenewarray(thishelpstoavoid

//StaticNodeListinstances)

for(vark=0;k<first.length;k++)

result[k]=first[k];

//Nowcheckforduplicatesbetweenaandbandonly

//addtheuniqueitems

for(vari=0;i<second.length;i++){

varnoCollision=true;

//Thecollision-checkingprocess

for(varj=0;j<first.length;j++)

if(second[i]==first[j])

noCollision=false;

//Iftheitemisunique,addit

if(noCollision)

result.push(second[i]);

}

returnresult;

},

grep:function(elems,fn,inv){

//Ifastringispassedinforthefunction,makeafunction

//forit(ahandyshortcut)

if(fn.constructor==String)

fn=newFunction("a","i","return"+fn);

varresult=[];

//Gothroughthearray,onlysavingtheitems

//thatpassthevalidatorfunction

for(vari=0;i<elems.length;i++)

if(!inv&&fn(elems[i],i)||inv&&!fn(elems[i],i))

result.push(elems[i]);

returnresult;

},

map:function(elems,fn){

//Ifastringispassedinforthefunction,makeafunction

//forit(ahandyshortcut)

if(fn.constructor==String)

fn=newFunction("a","return"+fn);

varresult=[];

//Gothroughthearray,translatingeachoftheitemstotheir

//newvalue(orvalues).

for(vari=0;i<elems.length;i++){

varval=fn(elems[i],i);

if(val!==null&&val!=undefined){

if(val.constructor!=Array)val=[val];

result=jQuery.merge(result,val);

}

}

returnresult;

},

/*

*Anumberofhelperfunctionsusedformanagingevents.

*ManyoftheideasbehindthiscodeorignatedfromDeanEdwards'addEventlibrary.

*/

event:{

//Bindaneventtoanelement

//OriginalbyDeanEdwards

add:function(element,type,handler){

//Forwhateverreason,IEhastroublepassingthewindowobject

//around,causingittobeclonedintheprocess

if(jQuery.browser.msie&&element.setInterval!=undefined)

element=window;

//MakesurethatthefunctionbeingexecutedhasauniqueID

if(!handler.guid)

handler.guid=this.guid++;

//Inittheelement'seventstructure

if(!element.events)

element.events={};

//Getthecurrentlistoffunctionsboundtothisevent

varhandlers=element.events[type];

//Ifithasn'tbeeninitializedyet

if(!handlers){

//Inittheeventhandlerqueue

handlers=element.events[type]={};

//Rememberanexistinghandler,ifit'salreadythere

if(element["on"+type])

handlers[0]=element["on"+type];

}

//Addthefunctiontotheelement'shandlerlist

handlers[handler.guid]=handler;

//Andbindtheglobaleventhandlertotheelement

element["on"+type]=this.handle;

//Rememberthefunctioninagloballist(fortriggering)

if(!this.global[type])

this.global[type]=[];

this.global[type].push(element);

},

guid:1,

global:{},

//Detachaneventorsetofeventsfromanelement

remove:function(element,type,handler){

if(element.events)

if(type&&element.events[type])

if(handler)

deleteelement.events[type][handler.guid];

else

for(variinelement.events[type])

deleteelement.events[type][i];

else

for(varjinelement.events)

this.remove(element,j);

},

trigger:function(type,data,element){

//Touchuptheincomingdata

data=data||[];

//Handleaglobaltrigger

if(!element){

varg=this.global[type];

if(g)

for(vari=0;i<g.length;i++)

this.trigger(type,data,g[i]);

//Handletriggeringasingleelement

}elseif(element["on"+type]){

//Passalongafakeevent

data.unshift(this.fix({type:type,target:element}));

//Triggertheevent

element["on"+type].apply(element,data);

}

},

handle:function(event){

if(typeofjQuery=="undefined")return;

event=event||jQuery.event.fix(window.event);

//Ifnocorrecteventwasfound,fail

if(!event)return;

varreturnValue=true;

varc=this.events[event.type];

varargs=[].slice.call(arguments,1);

args.unshift(event);

for(varjinc){

if(c[j].apply(this,args)===false){

event.preventDefault();

event.stopPropagation();

returnValue=false;

}

}

returnreturnValue;

},

fix:function(event){

if(event){

event.preventDefault=function(){

this.returnValue=false;

};

event.stopPropagation=function(){

this.cancelBubble=true;

};

}

returnevent;

}

}

});

newfunction(){

varb=navigator.userAgent.toLowerCase();

//Figureoutwhatbrowserisbeingused

jQuery.browser={

safari:/webkit/.test(b),

opera:/opera/.test(b),

msie:/msie/.test(b)&&!/opera/.test(b),

mozilla:/mozilla/.test(b)&&!/(compatible|webkit)/.test(b)

};

//ChecktoseeiftheW3Cboxmodelisbeingused

jQuery.boxModel=!jQuery.browser.msie||document.compatMode=="CSS1Compat";

};

jQuery.macros={

to:{

appendTo:"append",

prependTo:"prepend",

insertBefore:"before",

insertAfter:"after"

},

css:"width,height,top,left,position,float,overflow,color,background".split(","),

filter:["eq","lt","gt","contains"],

attr:{

val:"value",

html:"innerHTML",

id:null,

title:null,

name:null,

href:null,

src:null,

rel:null

},

axis:{

parent:"a.parentNode",

ancestors:jQuery.parents,

parents:jQuery.parents,

next:"jQuery.sibling(a).next",

prev:"jQuery.sibling(a).prev",

siblings:"jQuery.sibling(a,null,true)",

children:"jQuery.sibling(a.firstChild)"

},

each:{

removeAttr:function(key){

this.removeAttribute(key);

},

show:function(){

this.style.display=this.oldblock?this.oldblock:"";

if(jQuery.css(this,"display")=="none")

this.style.display="block";

},

hide:function(){

this.oldblock=this.oldblock||jQuery.css(this,"display");

if(this.oldblock=="none")

this.oldblock="block";

this.style.display="none";

},

toggle:function(){

jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"].apply(jQuery(this),arguments);

},

addClass:function(c){

jQuery.className.add(this,c);

},

removeClass:function(c){

jQuery.className.remove(this,c);

},

toggleClass:function(c){

jQuery.className[jQuery.className.has(this,c)?"remove":"add"](this,c);

},

remove:function(a){

if(!a||jQuery.filter(a,[this]).r)

this.parentNode.removeChild(this);

},

empty:function(){

while(this.firstChild)

this.removeChild(this.firstChild);

},

bind:function(type,fn){

if(fn.constructor==String)

fn=newFunction("e",(!fn.indexOf(".")?"jQuery(this)":"return")+fn);

jQuery.event.add(this,type,fn);

},

unbind:function(type,fn){

jQuery.event.remove(this,type,fn);

},

trigger:function(type,data){

jQuery.event.trigger(type,data,this);

}

}

};

jQuery.init();

jQuery.fn.extend({

//We'reoverridingtheoldtogglefunction,so

//rememberitforlater

_toggle:jQuery.fn.toggle,

toggle:function(a,b){

//Iftwofunctionsarepassedin,we're

//togglingonaclick

returna&&b&&a.constructor==Function&&b.constructor==Function?this.click(function(e){

//Figureoutwhichfunctiontoexecute

this.last=this.last==a?b:a;

//Makesurethatclicksstop

e.preventDefault();

//andexecutethefunction

returnthis.last.apply(this,[e])||false;

}):

//Otherwise,executetheoldtogglefunction

this._toggle.apply(this,arguments);

},

hover:function(f,g){

//Aprivatefunctionforhaandlingmouse'hovering'

functionhandleHover(e){

//Checkifmouse(over|out)arestillwithinthesameparentelement

varp=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;

//Traverseupthetree

while(p&&p!=this)try{p=p.parentNode}catch(e){p=this;};

//Ifweactuallyjustmousedontoasub-element,ignoreit

if(p==this)returnfalse;

//Executetherightfunction

return(e.type=="mouseover"?f:g).apply(this,[e]);

}

//Bindthefunctiontothetwoeventlisteners

returnthis.mouseover(handleHover).mouseout(handleHover);

},

ready:function(f){

//IftheDOMisalreadyready

if(jQuery.isReady)

//Executethefunctionimmediately

f.apply(document);

//Otherwise,rememberthefunctionforlater

else{

//Addthefunctiontothewaitlist

jQuery.readyList.push(f);

}

returnthis;

}

});

jQuery.extend({

/*

*AllthecodethatmakesDOMReadyworknicely.

*/

isReady:false,

readyList:[],

//HandlewhentheDOMisready

ready:function(){

//MakesurethattheDOMisnotalreadyloaded

if(!jQuery.isReady){

//RememberthattheDOMisready

jQuery.isReady=true;

//Iftherearefunctionsbound,toexecute

if(jQuery.readyList){

//Executeallofthem

for(vari=0;i<jQuery.readyList.length;i++)

jQuery.readyList[i].apply(document);

//Resetthelistoffunctions

jQuery.readyList=null;

}

//Removeeventlisentertoavoidmemoryleak

if(jQuery.browser.mozilla||jQuery.browser.opera)

document.removeEventListener("DOMContentLoaded",jQuery.ready,false);

}

}

});

newfunction(){

vare=("blur,focus,load,resize,scroll,unload,click,dblclick,"+

"mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select,"+

"submit,keydown,keypress,keyup,error").split(",");

//Gothroughalltheeventnames,butmakesurethat

//itisenclosedproperly

for(vari=0;i<e.length;i++)newfunction(){

varo=e[i];

//Handleeventbinding

jQuery.fn[o]=function(f){

returnf?this.bind(o,f):this.trigger(o);

};

//Handleeventunbinding

jQuery.fn["un"+o]=function(f){returnthis.unbind(o,f);};

//Finally,handleeventsthatonlyfireonce

jQuery.fn["one"+o]=function(f){

//Attachtheeventlistener

returnthis.each(function(){

varcount=0;

//Addtheevent

jQuery.event.add(this,o,function(e){

//Ifthisfunctionhasalreadybeenexecuted,stop

if(count++)return;

//Andexecutetheboundfunction

returnf.apply(this,[e]);

});

});

};

};

//IfMozillaisused

if(jQuery.browser.mozilla||jQuery.browser.opera){

//Usethehandyeventcallback

document.addEventListener("DOMContentLoaded",jQuery.ready,false);

//IfIEisused,usetheexcellenthackbyMatthiasMiller

//http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited

}elseif(jQuery.browser.msie){

//Onlyworksifyoudocument.write()it

document.write("<scr"+"iptid=__ie_initdefer=true"+

"src=//:></script>");

//Usethedeferscripthack

varscript=document.getElementById("__ie_init");

script.onreadystatechange=function(){

if(this.readyState!="complete")return;

this.parentNode.removeChild(this);

jQuery.ready();

};

//Clearfrommemory

script=null;

//IfSafariisused

}elseif(jQuery.browser.safari){

//Continuallychecktoseeifthedocument.readyStateisvalid

jQuery.safariTimer=setInterval(function(){

//loadedandcompletearebothvalidstates

if(document.readyState=="loaded"||

document.readyState=="complete"){

//Ifeitheronearefound,removethetimer

clearInterval(jQuery.safariTimer);

jQuery.safariTimer=null;

//andexecuteanywaitingfunctions

jQuery.ready();

}

},10);

}

//Afallbacktowindow.onload,thatwillalwayswork

jQuery.event.add(window,"load",jQuery.ready);

};

//CleanupafterIEtoavoidmemoryleaks

if(jQuery.browser.msie)jQuery(window).unload(function(){

varevent=jQuery.event,global=event.global;

for(vartypeinglobal){

varels=global[type],i=els.length;

if(i>0)doif(type!='unload')event.remove(els[i-1],type);while(--i);

}

});

jQuery.fn.extend({

//overwritetheoldshowmethod

_show:jQuery.fn.show,

show:function(speed,callback){

returnspeed?this.animate({

height:"show",width:"show",opacity:"show"

},speed,callback):this._show();

},

//Overwritetheoldhidemethod

_hide:jQuery.fn.hide,

hide:function(speed,callback){

returnspeed?this.animate({

height:"hide",width:"hide",opacity:"hide"

},speed,callback):this._hide();

},

slideDown:function(speed,callback){

returnthis.animate({height:"show"},speed,callback);

},

slideUp:function(speed,callback){

returnthis.animate({height:"hide"},speed,callback);

},

slideToggle:function(speed,callback){

returnthis.each(function(){

varstate=jQuery(this).is(":hidden")?"show":"hide";

jQuery(this).animate({height:state},speed,callback);

});

},

fadeIn:function(speed,callback){

returnthis.animate({opacity:"show"},speed,callback);

},

fadeOut:function(speed,callback){

returnthis.animate({opacity:"hide"},speed,callback);

},

fadeTo:function(speed,to,callback){

returnthis.animate({opacity:to},speed,callback);

},

animate:function(prop,speed,callback){

returnthis.queue(function(){

this.curAnim=prop;

for(varpinprop){

vare=newjQuery.fx(this,jQuery.speed(speed,callback),p);

if(prop[p].constructor==Number)

e.custom(e.cur(),prop[p]);

else

e[prop[p]](prop);

}

});

},

queue:function(type,fn){

if(!fn){

fn=type;

type="fx";

}

returnthis.each(function(){

if(!this.queue)

this.queue={};

if(!this.queue[type])

this.queue[type]=[];

this.queue[type].push(fn);

if(this.queue[type].length==1)

fn.apply(this);

});

}

});

jQuery.extend({

setAuto:function(e,p){

if(e.notAuto)return;

if(p=="height"&&e.scrollHeight!=parseInt(jQuery.curCSS(e,p)))return;

if(p=="width"&&e.scrollWidth!=parseInt(jQuery.curCSS(e,p)))return;

//Remembertheoriginalheight

vara=e.style[p];

//Figureoutthesizeoftheheightrightnow

varo=jQuery.curCSS(e,p,1);

if(p=="height"&&e.scrollHeight!=o||

p=="width"&&e.scrollWidth!=o)return;

//Settheheighttoauto

e.style[p]=e.currentStyle?"":"auto";

//Seewhatthesizeof"auto"is

varn=jQuery.curCSS(e,p,1);

//Revertbacktotheoriginalsize

if(o!=n&&n!="auto"){

e.style[p]=a;

e.notAuto=true;

}

},

speed:function(s,o){

o=o||{};

if(o.constructor==Function)

o={complete:o};

varss={slow:600,fast:200};

o.duration=(s&&s.constructor==Number?s:ss[s])||400;

//Queueing

o.oldComplete=o.complete;

o.complete=function(){

jQuery.dequeue(this,"fx");

if(o.oldComplete&&o.oldComplete.constructor==Function)

o.oldComplete.apply(this);

};

returno;

},

queue:{},

dequeue:function(elem,type){

type=type||"fx";

if(elem.queue&&elem.queue[type]){

//Removeself

elem.queue[type].shift();

//Getnextfunction

varf=elem.queue[type][0];

if(f)f.apply(elem);

}

},

/*

*Ioriginallywrotefx()asacloneofmoo.fxandintheprocess

*ofmakingitsmallinsizethecodebecameillegibletosane

*people.You'vebeenwarned.

*/

fx:function(elem,options,prop){

varz=this;

//Theusersoptions

z.o={

duration:options.duration||400,

complete:options.complete,

step:options.step

};

//Theelement

z.el=elem;

//Thestyles

vary=z.el.style;

//Simplefunctionforsettingastylevalue

z.a=function(){

if(options.step)

options.step.apply(elem,[z.now]);

if(prop=="opacity")

jQuery.attr(y,"opacity",z.now);//Letattrhandleopacity

elseif(parseInt(z.now))//MyhateforIEwillneverdie

y[prop]=parseInt(z.now)+"px";

y.display="block";

};

//Figureoutthemaximumnumbertorunto

z.max=function(){

returnparseFloat(jQuery.css(z.el,prop));

};

//Getthecurrentsize

z.cur=function(){

varr=parseFloat(jQuery.curCSS(z.el,prop));

returnr&&r>-10000?r:z.max();

};

//Startananimationfromonenumbertoanother

z.custom=function(from,to){

z.startTime=(newDate()).getTime();

z.now=from;

z.a();

z.timer=setInterval(function(){

z.step(from,to);

},13);

};

//Simple'show'function

z.show=function(p){

if(!z.el.orig)z.el.orig={};

//Rememberwherewestarted,sothatwecangobacktoitlater

z.el.orig[prop]=this.cur();

//Begintheanimation

if(prop=="opacity")

z.custom(z.el.orig[prop],1);

else

z.custom(0,z.el.orig[prop]);

//StupidIE,lookwhatyoumademedo

if(prop!="opacity")

y[prop]="1px";

};

//Simple'hide'function

z.hide=function(){

if(!z.el.orig)z.el.orig={};

//Rememberwherewestarted,sothatwecangobacktoitlater

z.el.orig[prop]=this.cur();

z.o.hide=true;

//Begintheanimation

z.custom(z.el.orig[prop],0);

};

//Remembertheoverflowoftheelement

if(!z.el.oldOverlay)

z.el.oldOverflow=jQuery.css(z.el,"overflow");

//Makesurethatnothingsneaksout

y.overflow="hidden";

//Eachstepofananimation

z.step=function(firstNum,lastNum){

vart=(newDate()).getTime();

if(t>z.o.duration+z.startTime){

//Stopthetimer

clearInterval(z.timer);

z.timer=null;

z.now=lastNum;

z.a();

z.el.curAnim[prop]=true;

vardone=true;

for(variinz.el.curAnim)

if(z.el.curAnim[i]!==true)

done=false;

if(done){

//Resettheoverflow

y.overflow=z.el.oldOverflow;

//Hidetheelementifthe"hide"operationwasdone

if(z.o.hide)

y.display='none';

//Resettheproperty,iftheitemhasbeenhidden

if(z.o.hide){

for(varpinz.el.curAnim){

if(p=="opacity"&&jQuery.browser.msie)

jQuery.attr(y,p,z.el.orig[p]);

else

y[p]=z.el.orig[p]+"px";

//setitsheightand/orwidthtoauto

if(p=='height'||p=='width')

jQuery.setAuto(z.el,p);

}

}

}

//Ifacallbackwasprovided,executeit

if(done&&z.o.complete&&z.o.complete.constructor==Function)

//Executethecompletefunction

z.o.complete.apply(z.el);

}else{

//Figureoutwhereintheanimationweareandsetthenumber

varp=(t-this.startTime)/z.o.duration;

z.now=((-Math.cos(p*Math.PI)/2)+0.5)*(lastNum-firstNum)+firstNum;

//Performthenextstepoftheanimation

z.a();

}

};

}

});

jQuery.fn.extend({

loadIfModified:function(url,params,callback){

this.load(url,params,callback,1);

},

load:function(url,params,callback,ifModified){

if(url.constructor==Function)

returnthis.bind("load",url);

callback=callback||function(){};

//DefaulttoaGETrequest

vartype="GET";

//Ifthesecondparameterwasprovided

if(params){

//Ifit'safunction

if(params.constructor==Function){

//Weassumethatit'sthecallback

callback=params;

params=null;

//Otherwise,buildaparamstring

}else{

params=jQuery.param(params);

type="POST";

}

}

varself=this;

//Requesttheremotedocument

jQuery.ajax(type,url,params,function(res,status){

if(status=="success"||!ifModified&&status=="notmodified"){

//InjecttheHTMLintoallthematchedelements

self.html(res.responseText).each(callback,[res.responseText,status]);

//Executeallthescriptsinsideofthenewly-injectedHTML

jQuery("script",self).each(function(){

if(this.src)

jQuery.getScript(this.src);

else

eval.call(window,this.text||this.textContent||this.innerHTML||"");

});

}else

callback.apply(self,[res.responseText,status]);

},ifModified);

returnthis;

},

serialize:function(){

returnjQuery.param(this);

}

});

//IfIEisused,createawrapperfortheXMLHttpRequestobject

if(jQuery.browser.msie&&typeofXMLHttpRequest=="undefined")

XMLHttpRequest=function(){

returnnewActiveXObject(

navigator.userAgent.indexOf("MSIE5")>=0?

"Microsoft.XMLHTTP":"Msxml2.XMLHTTP"

);

};

//AttachabunchoffunctionsforhandlingcommonAJAXevents

newfunction(){

vare="ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess".split(",");

for(vari=0;i<e.length;i++)newfunction(){

varo=e[i];

jQuery.fn[o]=function(f){

returnthis.bind(o,f);

};

};

};

jQuery.extend({

get:function(url,data,callback,type,ifModified){

if(data.constructor==Function){

type=callback;

callback=data;

data=null;

}

//append?+dataor&+data,incasetherearealreadyparams

if(data)url+=((url.indexOf("?")>-1)?"&":"?")+jQuery.param(data);

//BuildandstarttheHTTPRequest

jQuery.ajax("GET",url,null,function(r,status){

if(callback)callback(jQuery.httpData(r,type),status);

},ifModified);

},

getIfModified:function(url,data,callback,type){

jQuery.get(url,data,callback,type,1);

},

getScript:function(url,callback){

jQuery.get(url,callback,"script");

},

getJSON:function(url,data,callback){

if(callback)

jQuery.get(url,data,callback,"json");

else{

jQuery.get(url,data,"json");

}

},

post:function(url,data,callback,type){

//BuildandstarttheHTTPRequest

jQuery.ajax("POST",url,jQuery.param(data),function(r,status){

if(callback)callback(jQuery.httpData(r,type),status);

});

},

//timeout(ms)

timeout:0,

ajaxTimeout:function(timeout){

jQuery.timeout=timeout;

},

//Last-Modifiedheadercachefornextrequest

lastModified:{},

ajax:function(type,url,data,ret,ifModified){

//Ifonlyasingleargumentwaspassedin,

//assumethatitisaobjectofkey/valuepairs

if(!url){

ret=type.complete;

varsuccess=type.success;

varerror=type.error;

vardataType=type.dataType;

varglobal=typeoftype.global=="boolean"?type.global:true;

vartimeout=typeoftype.timeout=="number"?type.timeout:jQuery.timeout;

varifModified=type.ifModified||false;

data=type.data;

url=type.url;

type=type.type;

}

//Watchforanewsetofrequests

if(global&&!jQuery.active++)

jQuery.event.trigger("ajaxStart");

varrequestDone=false;

//Createtherequestobject

varxml=newXMLHttpRequest();

//Openthesocket

xml.open(type||"GET",url,true);

//Setthecorrectheader,ifdataisbeingsent

if(data)

xml.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

//SettheIf-Modified-Sinceheader,ififModifiedmode.

if(ifModified)

xml.setRequestHeader("If-Modified-Since",

jQuery.lastModified[url]||"Thu,01Jan197000:00:00GMT");

//Setheadersothecalledscriptknowsthatit'sanXMLHttpRequest

xml.setRequestHeader("X-Requested-With","XMLHttpRequest");

//Makesurethebrowsersendstherightcontentlength

if(xml.overrideMimeType)

xml.setRequestHeader("Connection","close");

//Waitforaresponsetocomeback

varonreadystatechange=function(istimeout){

//Thetransferiscompleteandthedataisavailable,ortherequesttimedout

if(xml&&(xml.readyState==4||istimeout=="timeout")){

requestDone=true;

varstatus=jQuery.httpSuccess(xml)&&istimeout!="timeout"?

ifModified&&jQuery.httpNotModified(xml,url)?"notmodified":"success":"error";

//Makesurethattherequestwassuccessfulornotmodified

if(status!="error"){

//CacheLast-Modifiedheader,ififModifiedmode.

varmodRes;

try{

modRes=xml.getResponseHeader("Last-Modified");

}catch(e){}//swallowexceptionthrownbyFFifheaderisnotavailable

if(ifModified&&modRes)

jQuery.lastModified[url]=modRes;

//Ifalocalcallbackwasspecified,fireit

if(success)

success(jQuery.httpData(xml,dataType),status);

//Firetheglobalcallback

if(global)

jQuery.event.trigger("ajaxSuccess");

//Otherwise,therequestwasnotsuccessful

}else{

//Ifalocalcallbackwasspecified,fireit

if(error)error(xml,status);

//Firetheglobalcallback

if(global)

jQuery.event.trigger("ajaxError");

}

//Therequestwascompleted

if(global)

jQuery.event.trigger("ajaxComplete");

//HandletheglobalAJAXcounter

if(global&&!--jQuery.active)

jQuery.event.trigger("ajaxStop");

//Processresult

if(ret)ret(xml,status);

//Stopmemoryleaks

xml.onreadystatechange=function(){};

xml=null;

}

};

xml.onreadystatechange=onreadystatechange;

//Timeoutchecker

if(timeout>0)

setTimeout(function(){

//Checktoseeiftherequestisstillhappening

if(xml){

//Canceltherequest

xml.abort();

if(!requestDone)onreadystatechange("timeout");

//Clearfrommemory

xml=null;

}

},timeout);

//Sendthedata

xml.send(data);

},

//Counterforholdingthenumberofactivequeries

active:0,

//DeterminesifanXMLHttpRequestwassuccessfulornot

httpSuccess:function(r){

try{

return!r.status&&location.protocol=="file:"||

(r.status>=200&&r.status<300)||r.status==304||

jQuery.browser.safari&&r.status==undefined;

}catch(e){}

returnfalse;

},

//DeterminesifanXMLHttpRequestreturnsNotModified

httpNotModified:function(xml,url){

try{

varxmlRes=xml.getResponseHeader("Last-Modified");

//Firefoxalwaysreturns200.checkLast-Modifieddate

returnxml.status==304||xmlRes==jQuery.lastModified[url]||

jQuery.browser.safari&&xml.status==undefined;

}catch(e){}

returnfalse;

},

/*GetthedataoutofanXMLHttpRequest.

*ReturnparsedXMLifcontent-typeheaderis"xml"andtypeis"xml"oromitted,

*otherwisereturnplaintext.

*(String)data-Thetypeofdatathatyou'reexpectingback,

*(e.g."xml","html","script")

*/

httpData:function(r,type){

varct=r.getResponseHeader("content-type");

vardata=!type&&ct&&ct.indexOf("xml")>=0;

data=type=="xml"||data?r.responseXML:r.responseText;

//Ifthetypeis"script",evalit

if(type=="script")eval.call(window,data);

//GettheJavaScriptobject,ifJSONisused.

if(type=="json")eval("data="+data);

returndata;

},

//Serializeanarrayofformelementsorasetof

//key/valuesintoaquerystring

param:function(a){

vars=[];

//Ifanarraywaspassedin,assumethatitisanarray

//offormelements

if(a.constructor==Array||a.jquery){

//Serializetheformelements

for(vari=0;i<a.length;i++)

s.push(a[i].name+"="+encodeURIComponent(a[i].value));

//Otherwise,assumethatit'sanobjectofkey/valuepairs

}else{

//Serializethekey/values

for(varjina)

s.push(j+"="+encodeURIComponent(a[j]));

}

//Returntheresultingserialization

returns.join("&");

}

});

}//close:if(typeofwindow.jQuery=="undefined"){

【jQuery 1.0.2】相关文章:

会自动逐行上升的文本框

jquery实现弹出层效果实例

Jquery实现动态切换图片的方法

JavaScript检查子字符串是否在字符串中的方法

网页常用Javascript

不错显示时间特效

状态栏(status)特效

JavaScript 定时器 SetTimeout之定时刷新窗口和关闭窗口(代码超简单)

Prototype1.4手册

Javascript 事件捕获的备忘(setCapture,captureEvents)

精品推荐
分类导航