33个JavaScript经典效果.docx

上传人:b****3 文档编号:11807471 上传时间:2023-06-02 格式:DOCX 页数:81 大小:58.55KB
下载 相关 举报
33个JavaScript经典效果.docx_第1页
第1页 / 共81页
33个JavaScript经典效果.docx_第2页
第2页 / 共81页
33个JavaScript经典效果.docx_第3页
第3页 / 共81页
33个JavaScript经典效果.docx_第4页
第4页 / 共81页
33个JavaScript经典效果.docx_第5页
第5页 / 共81页
33个JavaScript经典效果.docx_第6页
第6页 / 共81页
33个JavaScript经典效果.docx_第7页
第7页 / 共81页
33个JavaScript经典效果.docx_第8页
第8页 / 共81页
33个JavaScript经典效果.docx_第9页
第9页 / 共81页
33个JavaScript经典效果.docx_第10页
第10页 / 共81页
33个JavaScript经典效果.docx_第11页
第11页 / 共81页
33个JavaScript经典效果.docx_第12页
第12页 / 共81页
33个JavaScript经典效果.docx_第13页
第13页 / 共81页
33个JavaScript经典效果.docx_第14页
第14页 / 共81页
33个JavaScript经典效果.docx_第15页
第15页 / 共81页
33个JavaScript经典效果.docx_第16页
第16页 / 共81页
33个JavaScript经典效果.docx_第17页
第17页 / 共81页
33个JavaScript经典效果.docx_第18页
第18页 / 共81页
33个JavaScript经典效果.docx_第19页
第19页 / 共81页
33个JavaScript经典效果.docx_第20页
第20页 / 共81页
亲,该文档总共81页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

33个JavaScript经典效果.docx

《33个JavaScript经典效果.docx》由会员分享,可在线阅读,更多相关《33个JavaScript经典效果.docx(81页珍藏版)》请在冰点文库上搜索。

33个JavaScript经典效果.docx

33个JavaScript经典效果

33个JavaScript经典效果

一 实用且必用的小脚本代码:

脚本1:

进入主页以后自动播放声音 

//10.13.31.90/~kayvin/mihunji.rm" hidden=true autostart=true loop=true> 

脚本2:

进入主页后自动最大话,省的去在自己单击了 

 

脚本3:

显示现在时间的脚本 

document.write now

脚本4:

显示最后修改时间的脚本 

 

脚本5:

设为首页,加为收藏,加入频道,启动outlook发信

 

hand" 

onclick="this.style.behavior="url(#default#homepage)"; 

this.setHomePage(http:

//10.13.31.90/~kayvin/);">">设为首页 

hand" 

onclick="window.external.AddFavorite(location.href,document.title);">加入收藏 

window.external.addChannel("typhoon.cdf")>加入频道 

kayvin@">与我联系 

脚本6:

状态栏动态显示现在时间 

 

 

脚本7:

关闭窗口的脚本 

close()>[关闭窗口] 

脚本8:

按下F12键,直接返回首页 

 

脚本9:

后退,刷新,前进 

 

 

 

脚本10:

设定时间弹出窗口,4000=4秒,当然你可以自定义 

二 鼠标旁边的提示信息,类似与163登录后的页面提示效果:

tip 

 

//***********默认设置定义.********************* 

tPopWait=50;//停留tWait豪秒后显示提示。

 

tPopShow=5000;//显示tShow豪秒后关闭提示 

showPopStep=20; 

popOpacity=99; 

//***************内部变量定义***************** 

sPop=null; 

curShow=null; 

tFadeOut=null; 

tFadeIn=null; 

tFadeWaiting=null; 

document.write(""); 

document.write(".cPopText { background-color:

 #F8F8F5;color:

#000000; border:

 1px #000000 solid;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(""); 

document.write("

absolute;z-index:

1000;' class='cPopText'>

"); 

function showPopupText(){ 

var o=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.dyclass 

else popStyle="cPopText"; 

curShow=setTimeout("showIt()",tPopWait); 

function showIt(){ 

dypopLayer.className=popStyle; 

dypopLayer.innerHTML=sPop; 

popWidth=dypopLayer.clientWidth; 

popHeight=dypopLayer.clientHeight; 

if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24 

else popLeftAdjust=0; 

if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24 

else popTopAdjust=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(); 

function fadeOut(){ 

if(dypopLayer.filters.Alpha.opacity

dypopLayer.filters.Alpha.opacity+=showPopStep; 

tFadeOut=setTimeout("fadeOut()",1); 

else { 

dypopLayer.filters.Alpha.opacity=popOpacity; 

tFadeWaiting=setTimeout("fadeIn()",tPopShow); 

function fadeIn(){ 

if(dypopLayer.filters.Alpha.opacity>0) { 

dypopLayer.filters.Alpha.opacity-=1; 

tFadeIn=setTimeout("fadeIn()",1); 

document.onmouseover=showPopupText; 

三 如果文字过长,则将过长的部分变成省略号显示:

 120px; height:

 50px; border:

 1px solid blue; overflow:

 hidden; text-overflow:

ellipsis"> 

就是比如有一行文字,很长,表格内一行显示不下. 

四 滚动的图片:

imgArr=new Array()

imgArr[0]="

outHover=true' onMouseover='javascript:

outHover=true' onMouseout='javascript:

outHover=false;mvStart()'>"

imgArr[1]="

outHover=true' onMouseover='javascript:

outHover=true' onMouseout='javascript:

outHover=false;mvStart()'>"

imgArr[2]="

outHover=true' onMouseover='javascript:

outHover=true' onMouseout='javascript:

outHover=false;mvStart()'>"

imgArr[3]="

outHover=true' onMouseover='javascript:

outHover=true' onMouseout='javascript:

outHover=false;mvStart()'>"

imgArr[4]="

outHover=true' onMouseover='javascript:

outHover=true' onMouseout='javascript:

outHover=false;mvStart()'>"

var moveStep=4        //步长,单位:

pixel

var moveRelax=100    //移动时间间隔,单位:

ms

ns4=(document.layers)?

true:

false

var displayImgAmount=4    //视区窗口可显示个数

var divWidth=220    //每块图片占位宽

var divHeight=145    //每块图片占位高

var startDnum=0

var nextDnum=startDnum+displayImgAmount

var timeID

var outHover=false

var startDivClipLeft

var nextDivClipRight

function initDivPlace(){

    if (ns4){

        for (i=0;i

            eval("document.divOuter.document.divAds"+i+".left="+divWidth*i)

        }

        for (i=displayImgAmount;i

            eval("document.divOuter.document.divAds"+i+".left="+divWidth*displayImgAmount)

        }

    }else{

        for (i=0;i

            eval("document.all.divAds"+i+".style.left="+divWidth*i)

        }

        for (i=displayImgAmount;i

            eval("document.all.divAds"+i+".style.left="+divWidth*displayImgAmount)

        }

    }

}

function mvStart(){

    timeID=setTimeout(moveLeftDiv,moveRelax)

}

function mvStop(){

    clearTimeout(timeID)

}

function moveLeftDiv(){

    if (ns4){

        for (i=0;i<=displayImgAmount;i++){            eval("document.divOuter.document.divAds"+parseInt((startDnum+i)%imgArr.length)+".left=document.divOuter.document.divAds"+parseInt((startDnum+i)%imgArr.length)+".left-moveStep")

        }

        startDivClipLeft=parseInt(eval("document.divOuter.document.divAds"+startDnum+".clip.left"))

        nextDivClipRight=parseInt(eval("document.divOuter.document.divAds"+nextDnum+".clip.right"))

        if (startDivClipLeft+moveStep>divWidth){

            eval("document.divOuter.document.divAds"+nextDnum+".clip.right="+divWidth)

            eval("document.divOuter.document.divAds"+startDnum+".left="+divWidth*displayImgAmount) eval("document.divOuter.document.divAds"+parseInt((nextDnum+1)%imgArr.length)+".left=document.divOuter.document.divAds"+nextDnum+".left+"+divWidth)            eval("document.divOuter.document.divAds"+parseInt((nextDnum+1)%imgArr.length)+".clip.left=0")           

            startDnum=(++startDnum)%imgArr.length

            nextDnum=(startDnum+displayImgAmount)%imgArr.length           

            startDivClipLeft=moveStep-(divWidth-startDivClipLeft)

            nextDivClipRight=moveStep-(divWidth-nextDivClipRight)

        }else{

            eval("document.divOuter.document.divAds"+nextDnum+".clip.left=0")

            startDivClipLeft+=moveStep

            nextDivClipRight+=moveStep

        }

        eval("document.divOuter.document.divAds"+startDnum+".clip.left="+startDivClipLeft)

        eval("document.divOuter.document.divAds"+nextDnum+".clip.right="+nextDivClipRight)

    }else{

        for (i=0;i<=displayImgAmount;i++){

            eval("document.all.divAds"+parseInt((startDnum+i)%imgArr.length)+".style.left=document.all.divAds"+parseInt((startDnum+i)%imgArr.length)+".style.pixelLeft-moveStep")

        }   

        startDivClipLeft=parseInt(eval("document.all.divAds"+startDnum+".currentStyle.clipLeft"))

        nextDivClipRight=parseInt(eval("document.all.divAds"+nextDnum+".currentStyle.clipRight"))  

        if (startDivClipLeft+moveStep>divWidth){           eval("document.all.divAds"+nextDnum+".style.clip='rect(0,"+divWidth+","+divHeight+",0"+")'")           

            eval("document.all.divAds"+startDnum+".style.left="+divWidth*displayImgAmount)            eval("document.all.divAds"+parseInt((nextDnum+1)%imgArr.length)+".style.left=document.all.divAds"+nextDnum+".style.pixelLeft+"+divWidth)           

            startDnum=(++startDnum)%imgArr.length

            nextDnum=(startDnum+displayImgAmount)%imgArr.length          

            startDivClipLeft=moveStep-(divWidth-startDivClipLeft)

            nextDivClipRight=moveStep-(divWidth-nextDivClipRight)

        }else{

            startDivClipLeft+=moveStep

            nextDivClipRight+=moveStep

        }       eval("document.all.divAds"+startDnum+".style.clip='rect(0,"+divWidth+","+divHeight+","+startDivClipLeft+")'")        eval("document.all.divAds"+nextDnum+".style.clip='rect(0,"+nextDivClipRight+","+divHeight+",0)'")

    }

    if (outHover){

        mvStop()

    }else{

        mvStart()

    }  

}

function writeDivs(){

    if (ns4){

        document.write("")       

        for (i=0;i

            document.write("")

            document.write(imgArr[i]+" ")

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工作范文 > 行政公文

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2