您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 能源与动力工程 > [收集]网页特效、JavaScript经典效果
[收集]网页特效、JavaScript经典效果一些很实用且必用的小脚本代码:脚本1:进入主页以后自动播放声音embedsrc=pnm://10.13.31.90/~kayvin/mihunji.rmhidden=trueautostart=trueloop=true脚本2:进入主页后自动最大话,省的去在自己单击了scriptself.moveTo(0,0)self.resizeTo(screen.availWidth,screen.availHeight)/script脚本3:显示现在时间的脚本scriptlanguage=vbscriptdocument.writenow/script脚本4:显示最后修改时间的脚本scriptdocument.write(document.lastModified)/script脚本5:设为首页,加为收藏,加入频道,启动outlook发信astyle=cursor:handonclick=this.style.behavior=url(#default#homepage);this.setHomePage(~kayvin/);设为首页/aastyle=cursor:handonclick=window.external.AddFavorite(location.href,document.title);加入收藏/aahref=javascript:window.external.addChannel(typhoon.cdf)加入频道/aahref=mailtkayvin@sohu.com与我联系/a脚本6:状态栏动态显示现在时间scriptfunctionsee(){window.setTimeout(see(),1000);today=newDate();self.status=today.toString();}/scriptbodyonload=see()脚本7:关闭窗口的脚本ahref=javascript:close()[关闭窗口]/a脚本8:按下F12键,直接返回首页scriptfunctionlook(){if(event.keyCode==123){document.location.href=~kayvin/}}if(document.onkeydown==null){document.onkeydown=look}/script脚本9:后退,刷新,前进inputtype=buttonvalue=后退onclick=history.go(-1)inputtype=buttonvalue=刷新onclick=history.go(-0)inputtype=buttonvalue=前进onclick=history.go(+1)脚本10:设定时间弹出窗口,4000=4秒,当然你可以自定义scriptfunctionl(){window.open(10.13.31.90/~kayvin/,name,width=500,height=150,border=0)}setTimeout(l(),4000)/script二鼠标旁边的提示信息,类似与163登录后的页面提示效果ahref=#title=这是提示tip/ascriptLanguage=javascript:;onClick=tagshow(event,'JavaScript');returnfalse;JavaScript\//***********默认设置定义.*********************tPopWait=50;//停留tWait豪秒后显示提示。tPopShow=5000;//显示tShow豪秒后关闭提示showPopStep=20;popOpacity=99;//***************内部变量定义*****************sPop=null;curShow=null;tFadeOut=null;tFadeIn=null;tFadeWaiting=null;document.write(styletype='text/css'id='defaultPopStyle');document.write(.cPopText{background-color:#F8F8F5;color:#000000;border:1px#000000solid;font-color:font-size:12px;padding-right:4px;padding-left:4px;height:20px;padding-top:2px;padding-bottom:2px;filter:Alpha(Opacity=0)});document.write(/style);document.write(divid='dypopLayer'style='position:absolute;z-index:1000;'class='cPopText'/div);functionshowPopupText(){varo=event.srcElement;MouseX=event.x;MouseY=event.y;if(o.alt!=null&&o.alt!=){o.dypop=o.alt;o.alt=};if(o.title!=null&&o.title!=){o.dypop=o.title;o.title=};if(o.dypop!=sPop){sPop=o.dypop;clearTimeout(curShow);clearTimeout(tFadeOut);clearTimeout(tFadeIn);clearTimeout(tFadeWaiting);if(sPop==null||sPop==){dypopLayer.innerHTML=;dypopLayer.style.filter=Alpha();dypopLayer.filters.Alpha.opacity=0;}else{if(o.dyclass!=null)popStyle=o.dyclasselsepopStyle=cPopText;curShow=setTimeout(showIt(),tPopWait);}}}functionshowIt(){dypopLayer.className=popStyle;dypopLayer.innerHTML=sPop;popWidth=dypopLayer.clientWidth;popHeight=dypopLayer.clientHeight;if(MouseX+12+popWidthdocument.body.clientWidth)popLeftAdjust=-popWidth-24elsepopLeftAdjust=0;if(MouseY+12+popHeightdocument.body.clientHeight)popTopAdjust=-popHeight-24elsepopTopAdjust=0;dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;dypopLayer.style.filter=Alpha(Opacity=0);fadeOut();}functionfadeOut(){if(dypopLayer.filters.Alpha.opacitypopOpacity){dypopLayer.filters.Alpha.opacity+=showPopStep;tFadeOut=setTimeout(fadeOut(),1);}else{dypopLayer.filters.Alpha.opacity=popOpacity;tFadeWaiting=setTimeout(fadeIn(),tPopShow);}}functionfadeIn(){if(dypopLayer.filters.Alpha.opacity0){dypopLayer.filters.Alpha.opacity-=1;tFadeIn=setTimeout(fadeIn(),1);}}document.onmouseover=showPopupText;/script三如果文字过长,则将过长的部分变成省略号显示HTML代码DIVSTYLE=width:120px;height:50px;border:1pxsolidblue;overflow:hidden;text-overflow:ellipsisNOBR就是比如有一行文字,很长,表格内一行显示不下./NOBR/DIV四滚动的图片HTML代码scriptlanguage=javascriptimgArr=newArray()imgArr[0]=ahref=#onmouseMove='javascriptutHover=true'onMouseover='javascriptutHover=true'onMouseout='javascriptutHover=false;mvStart()'imgsrc==0/aimgArr[1]=ahref=#onmouseMove='javascript:outHover=true'onMouseover='javascript:outHover=true'onMouseout='javascript:outHover=false;mvStart()'imgsrc==0/aimgArr[2]=ahref=#onmouseMove='javascript:outHover=true'onMouseover='javascript:outHover=true'onMouseout='javascript:outHover=false;mvStart()'imgsrc==0/aimgArr[3]=ahref=#onmouseMove='javascript:outHover=true'onMouseover='javascript:outHover=true'onMouseout='javascript:outHover=false;mvStart()'imgsrc==0/aimgArr[4]=ahref=#onmouseMove='javascript:outHover=true'onMouseover='javascript:outHover=true'onMouseout='javascript:outHover=false;mvStart()'imgsrc==0/avarmoveStep=4//步长,单位:pixelvarmoveRelax=100//移动时间间隔,单位:msns4=(document.layers)?true:falsevardisp
本文标题:[收集]网页特效、JavaScript经典效果
链接地址:https://www.777doc.com/doc-6340649 .html