javascript常用代码大全(2)打开模式对话框返回模式对话框的值全屏幕打开IE窗口脚本中中使用xml一、验证类1、数字验证内2、时间类3、表单类4、字符类5、浏览器类6、结合类二、功能类1、时间与相关控件类2、表单类3、打印类4、事件类5、网页设计类6、树型结构。7、无边框效果的制作8、连动下拉框技术9、文本排序10,画图类,含饼、柱、矢量贝滋曲线11,操纵客户端注册表类12,DIV层相关(拖拽、显示、隐藏、移动、增加)13,TABLAE相关(客户端动态增加行列,模拟进度条,滚动列表等)14,各种objectclassid=相关类,如播放器,flash与脚本互动等16,刷新/模拟无刷新异步调用类(XMLHttp或iframe,frame)一个可以在页面上随意画线、多边形、圆,填充等功能的js(part2)functionmkOv2D(left,top,width,height){vars=this.stroke;width+=s-1;height+=s-1;vara=width1,b=height1,wod=width&1,hod=(height&1)+1,cx=left+a,cy=top+b,x=0,y=b,aa=(a*a)1,bb=(b*b)1,st=(aa1)*(1-(b1))+bb,tt=(bb1)-aa*((b1)-1);if(s-40&&(!(s-2)||width-510&&height-510)){varox=0,oy=b,w,h,pxl,pxr,pxt,pxb,pxw;while(y0){if(st0){st+=bb*((x1)+3);tt+=(bb1)*(++x);}elseif(tt0){st+=bb*((x1)+3)-(aa1)*(y-1);tt+=(bb1)*(++x)-aa*(((y--)1)-3);w=x-ox;h=oy-y;if(w-1){pxw=w+1+(s&1);h=s;}elseif(h-1){pxw=s;h+=1+(s&1);}elsepxw=h=s;this.mkOvQds(cx,cy,-x+1,ox-pxw+w+wod,-oy,-h+oy+hod,pxw,h);ox=x;oy=y;}else{tt-=aa*((y1)-3);st-=(aa1)*(--y);}}this.mkDiv(cx-a,cy-oy,s,(oy1)+hod);this.mkDiv(cx+a+wod-s+1,cy-oy,s,(oy1)+hod);}else{var_a=(width-((s-1)1))1,_b=(height-((s-1)1))1,_x=0,_y=_b,_aa=(_a*_a)1,_bb=(_b*_b)1,_st=(_aa1)*(1-(_b1))+_bb,_tt=(_bb1)-_aa*((_b1)-1),pxl=newArray(),pxt=newArray(),_pxb=newArray();pxl[0]=0;pxt[0]=b;_pxb[0]=_b-1;while(y0){if(st0){st+=bb*((x1)+3);tt+=(bb1)*(++x);pxl[pxl.length]=x;pxt[pxt.length]=y;}elseif(tt0){st+=bb*((x1)+3)-(aa1)*(y-1);tt+=(bb1)*(++x)-aa*(((y--)1)-3);pxl[pxl.length]=x;pxt[pxt.length]=y;}else{tt-=aa*((y1)-3);st-=(aa1)*(--y);}if(_y0){if(_st0){_st+=_bb*((_x1)+3);_tt+=(_bb1)*(++_x);_pxb[_pxb.length]=_y-1;}elseif(_tt0){_st+=_bb*((_x1)+3)-(_aa1)*(_y-1);_tt+=(_bb1)*(++_x)-_aa*(((_y--)1)-3);_pxb[_pxb.length]=_y-1;}else{_tt-=_aa*((_y1)-3);_st-=(_aa1)*(--_y);_pxb[_pxb.length-1]--;}}}varox=0,oy=b,_oy=_pxb[0],l=pxl.length,w,h;for(vari=0;il;i++){if(typeof_pxb[i]!=undefined){if(_pxb[i]_oy||pxt[i]oy){x=pxl[i];this.mkOvQds(cx,cy,-x+1,ox+wod,-oy,_oy+hod,x-ox,oy-_oy);ox=x;oy=pxt[i];_oy=_pxb[i];}}else{x=pxl[i];this.mkDiv(cx-x+1,cy-oy,1,(oy1)+hod);this.mkDiv(cx+ox+wod,cy-oy,1,(oy1)+hod);ox=x;oy=pxt[i];}}this.mkDiv(cx-a,cy-oy,1,(oy1)+hod);this.mkDiv(cx+ox+wod,cy-oy,1,(oy1)+hod);}}functionmkOvDott(left,top,width,height){vara=width1,b=height1,wod=width&1,hod=height&1,cx=left+a,cy=top+b,x=0,y=b,aa2=(a*a)1,aa4=aa21,bb=(b*b)1,st=(aa21)*(1-(b1))+bb,tt=(bb1)-aa2*((b1)-1),drw=true;while(y0){if(st0){st+=bb*((x1)+3);tt+=(bb1)*(++x);}elseif(tt0){st+=bb*((x1)+3)-aa4*(y-1);tt+=(bb1)*(++x)-aa2*(((y--)1)-3);}else{tt-=aa2*((y1)-3);st-=aa4*(--y);}if(drw)this.mkOvQds(cx,cy,-x,x+wod,-y,y+hod,1,1);drw=!drw;}}一个可以在页面上随意画线、多边形、圆,填充等功能的js(part3)functionmkRect(x,y,w,h){vars=this.stroke;this.mkDiv(x,y,w,s);this.mkDiv(x+w,y,s,h);this.mkDiv(x,y+h,w+s,s);this.mkDiv(x,y+s,s,h-s);}functionmkRectDott(x,y,w,h){this.drawLine(x,y,x+w,y);this.drawLine(x+w,y,x+w,y+h);this.drawLine(x,y+h,x+w,y+h);this.drawLine(x,y,x,y+h);}functionjsgFont(){this.PLAIN='font-weight:normal;';this.BOLD='font-weight:bold;';this.ITALIC='font-style:italic;';this.ITALIC_BOLD=this.ITALIC+this.BOLD;this.BOLD_ITALIC=this.ITALIC_BOLD;}varFont=newjsgFont();functionjsgStroke(){this.DOTTED=-1;}varStroke=newjsgStroke();functionjsGraphics(id,wnd){this.setColor=newFunction('arg','this.color=arg.toLowerCase();');this.setStroke=function(x){this.stroke=x;if(!(x+1)){this.drawLine=mkLinDott;this.mkOv=mkOvDott;this.drawRect=mkRectDott;}elseif(x-10){this.drawLine=mkLin2D;this.mkOv=mkOv2D;this.drawRect=mkRect;}else{this.drawLine=mkLin;this.mkOv=mkOv;this.drawRect=mkRect;}};this.setPrintable=function(arg){this.printable=arg;if(jg_fast){this.mkDiv=mkDivIe;this.htmRpc=arg?htmPrtRpc:htmRpc;}elsethis.mkDiv=jg_n4?mkLyr:arg?mkDivPrt:mkDiv;};this.setFont=function(fam,sz,sty){this.ftFam=fam;this.ftSz=sz;this.ftSty=sty||Font.PLAIN;};this.drawPolyline=this.drawPolyLine=function(x,y,s){for(vari=0;ix.length-1;i++)this.drawLine(x[i],y[i],x[i+1],y[i+1]);};this.fillRect=function(x,y,w,h){this.mkDiv(x,y,w,h);};this.drawPolygon=function(x,y){this.drawPolyline(x,y);this.drawLine(x[x.length-1],y[x.length-1],x[0],y[0]);};this.drawEllipse=this.drawOval=function(x,y,w,h){this.mkOv(x,y,w,h);};this.fillEllipse=this.fillOval=function(left,top,w,h){vara=(w-=1)1,b=(h-=1)1,wod=(w&1)+1,hod=(h&1)+1,cx=left+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa2=(a*a)1,aa4=aa21,bb=(b*b)1,st=(aa21)*(1-(b1))+bb,tt=(bb1)-aa2*((b1)-1),pxl,dw,dh;if(w+1)while(y0){if(st0){st+=bb*((x1)+3);tt+=(bb1)*(++x);}elseif(tt0){st+=bb*((x1)+3)-aa4*(y-1);pxl=cx-x;dw=(x1)+wod;tt+=(bb1)*(++x)-aa2*(((y--)1)-3);dh=oy-y;this.mkDiv(pxl,cy-oy,dw,dh);this.mkDiv(pxl,cy+oy-dh+hod,dw,dh);ox=x;oy=y;}else{tt-=aa2*((y1)-3);st-=aa4*(--y);}}this.mkDiv(cx-a,cy-oy,w+1,(oy1)+hod);};this.fillPolygon=function(array_x,array_y){vari;vary;varminy,maxy;varx1,y1;varx2,y2;varind1,ind2;varints;varn=array_x.length;if(!n)return;miny=array_y[0];maxy=array_y[0];for(i=1;in;i++){if