JS常用代码锦集

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

1、立体效果的导航条把如下代码加入body区域中STYLEtype=text/cssA:link{TEXT-DECORATION:none}A:visited{TEXT-DECORATION:none}A:active{TEXT-DECORATION:none}A:hover{TEXT-DECORATION:none}.up{BORDER-RIGHT:#7112001pxsolid;PADDING-RIGHT:1px;BORDER-TOP:white1pxsolid;PADDING-LEFT:1px;FONT-SIZE:9pt;PADDING-BOTTOM:1px;BORDER-LEFT:white1pxsolid;COLOR:#ff0000;PADDING-TOP:1px;BORDER-BOTTOM:#7112001pxsolid;FONT-FAMILY:Tahoma;BACKGROUND-COLOR:#eadfd0}/STYLESCRIPTlanguage=JavaScript!--IEandNS6MenuButtonscriptkurt.grigg@virgin.netif(!document.layers){//Choosesizeandcolourshere!Width=100;Font='Verdana';FontSize=9;AFontColor='#000000';BFontColor='red';CFontColor='#ffffff';down=#6699cc;FontWeight='normal';//normalorbold!BackGround='#99ccff';//Sameasyourbodybgcolor!BorderDepth=2;BorderLight='#FFFFFF';BorderShad='#000000';//Nothingneedsalteringpasthere!!!!!!!!!!!!!!!!!!!!!!functionOn(id){with(id.style){color=BFontColor;borderTopColor=BorderLight;borderLeftColor=BorderLight;borderRightColor=BorderShad;borderBottomColor=BorderShad;}}functionOff(id){with(id.style){color=AFontColor;borderTopColor=BackGround;borderLeftColor=BackGround;borderRightColor=BackGround;borderBottomColor=BackGround;background=BackGround;}}functionDown(id){with(id.style){color=CFontColor;borderTopColor=BorderShad;borderLeftColor=BorderShad;borderRightColor=BorderLight;borderBottomColor=BorderLight;background=down;}}functionLink(Url,Txt,target){document.write(ahref='+Url+'target='+target+'+divstyle='position:relative;+width:+Width+px;height:+FontSize+px;+border-width:+BorderDepth+px;+border-color:+BackGround+;+border-style:solid;+padding:+FontSize/4.5+pt;+background:+BackGround+;+font-family:+Font+;+font-size:+FontSize+pt;+line-height:+FontSize*1.2+pt;+font-weight:+FontWeight+;+text-align:left;+color:+AFontColor+;+margin-top:2px;+cursor:hand'+onMouseOver='javascript:On(this)'+onMouseOut='javascript:Off(this)'+onMouseDown='javascript:Down(this)'+Txt+/div/a);}}functionTemp(){alert(TEST);}//--/SCRIPT!--EndMenuButtonsPart:1--!--MenuButtonsPart:2PasteinBodywhereneeded--SCRIPTlanguage=JavaScript!--if(!document.layers){//ThistablestopsoddnessinNS6!!!if(document.getElementById&&!document.all){document.write(divstyle='position:relative'+tableborder='0'cellpadding='0'cellspacing='0'+trtdvalign='top');}/*ThevisibleButtonshere!Addasmanyasyouwant.Makesureyoufollowthesameformatasbeloweg:Link('MyOtherPage.html','Seemyotherpage');*/Link('搜狐','_blank');Link('仲夏夜','_blank');Link(');Link(');Link('洪恩在线','_blank');Link('网易','main');Link(');Link('无忧视窗','_blank');if(document.getElementById&&!document.all){document.write(/td/tr/table/div);}}//--/SCRIPT2、打开页面特效:从中间向两边方向分开的打开方法把如下代码加入body区域中divid=i1class=intro/divdivid=i2class=intro/divscriptlanguage=JavaScript1.2varspeed=20vartemp=newArray()vartemp2=newArray()if(document.layers){for(i=1;i=2;i++){temp[i]=eval(document.i+i+.clip)temp2[i]=eval(document.i+i)temp[i].width=window.innerWidth/2temp[i].height=window.innerHeighttemp2[i].left=(i-1)*temp[i].width}}elseif(document.all){varclipright=document.body.clientWidth/2,clipleft=0for(i=1;i=2;i++){temp[i]=eval(document.all.i+i+.style)temp[i].width=document.body.clientWidth/2temp[i].height=document.body.offsetHeighttemp[i].left=(i-1)*parseInt(temp[i].width)}}functionopenit(){window.scrollTo(0,0)if(document.layers){temp[1].right-=speedtemp[2].left+=speedif(temp[2].leftwindow.innerWidth/2)clearInterval(stopit)}elseif(document.all){clipright-=speedtemp[1].clip=rect(0+clipright+auto0)clipleft+=speedtemp[2].clip=rect(0autoauto+clipleft+)if(clipright=0)clearInterval(stopit)}}functiongogo(){stopit=setInterval(openit(),100)}gogo()/scriptstyle!--.intro{position:absolute;left:0;top:0;layer-background-color:red;background-color:red;border:0.1pxsolidred}--/style3、从中间向上下方向分开的打开特效把如下代码加入body区域中divid=i1class=intro/divdivid=i2class=intro/divscriptlanguage=JavaScript1.2varspeed=20vartemp=newArray()vartemp2=newArray()if(document.layers){for(i=1;i=2;i++){temp[i]=eval(document.i+i+.clip)temp2[i]=eval(document.i+i)temp[i].width=window.innerWidthtemp[i].height=window.innerHeight/2temp2[i].top=(i-1)*temp[i].height}}elseif(document.all){varclipbottom=document.body.offsetHeight/2,cliptop=0for(i=1;i=2;i++){temp[i]=eval(document.all.i+i+.style)temp[i].width=document.body.clientWidthtemp[i].height=document.body.offsetHeight/2temp[i].top=(i-1)*parseInt(temp[i].height)}}functionopenit(){window.scrollTo(0,0)if(document.layers){temp[1].bottom-=speedtemp[2].top+=speedif(temp[1].bottom=0)clearInterval(stopit)}elseif(document.all){clipbottom-=speedtemp[1].clip=rect(0auto++clipbottom+0)cliptop+=speedtemp[2].clip=rect(+cliptop+autoauto)if(clipbottom=0)clearInterval(stopit)}}functiongogo(){stopit=setInterval(openit(),100)}gogo()/scri

1 / 69
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功