154、精彩的特效字

154、精彩的特效字

脚本说明:

第一步:把如下代码加入<body>区域中

<style type="text/css">

 

.textstyle {

       position:absolute;

       left:-2000px;

    width:400px;

    font-family:Arial;

    font-size:20pt;

    font-weight:bold;

    text-align:center;

       color:FFFFFF;

    filter:glow(color=red,strength=2);

}

 

.coverstyle      {

       position:absolute;

       left:-2000px;

}

</style>

<script LANGUAGE="JavaScript1.2">

<!--begin

var message = new Array()

message[0]="欢迎光临www.7stk.com"

message[1]="本站有超过500种的javascript特效"

message[2]="这些特效主要是来自国外的一些相关站点!"

message[3]="每星期都有15种左右的特效与您见面!"

message[4]="只要你经常光临,就一定会有收获的!"

message[5]="JavaScript再次谢谢你的光临!"

 

var i_message=0

 

 

var covertop=90

var coverleft=180

 

 

var coverwidth=1200

var coverheight=96

 

var texttop=covertop

var textleft=coverleft

//configure width of text effect

//be sure to change the corresponding width attribute above in the <style> tag to match

var textwidth=400

var textheight=coverheight

 

var cliptop=0

var clipright=textwidth

var clipbottom=coverheight

var clipleft=0

 

var clippoints

 

// Configure the speeds of the wipeing effect

var step=20

var pause=40

 

var timer

 

function init() {

    if (document.all) {

           document.all.text.style.posTop=texttop

        document.all.text.style.posLeft=textleft

        document.all.cover.style.posTop=covertop

        document.all.cover.style.posLeft=coverleft

        clipleft=0

        fadeout()

    }

}

 

function fadeout() {

    if (document.all.cover.style.posLeft >=(-coverwidth+textwidth+coverleft+step)) {  

        clipleft+=step

        clipright=clipleft+textwidth

        clippoints="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

              document.all.cover.style.clip=clippoints

        document.all.cover.style.posLeft-=step

        timer= setTimeout("fadeout()",pause)

    }

    else {

        clearTimeout(timer)

        i_message++

        if (i_message>=message.length) {i_message=0}

        text.innerHTML=message[i_message]  

        fadein()

 

    }

}

 

function fadein() {

    if (document.all.cover.style.posLeft <=coverleft) {  

        clipleft-=step

        clipright=clipleft+textwidth

        clippoints="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

              document.all.cover.style.clip=clippoints

        document.all.cover.style.posLeft+=step

        timer= setTimeout("fadein()",pause)

    }

    else {

        clearTimeout(timer)

        init()

    }

}

 

 

</script>

<script language="JavaScript">

if (document.all&&window.print){

document.write('<DIV ID="text" class="textstyle">'+message[0]+'</div>')

document.write('<DIV ID="cover" class="coverstyle"><img src="slidefader.gif"></DIV>')

}

</script>

 

 

 

第二步:把<body>中的内容改为:

<body onLoad="if(document.all&&window.print)init()">

 

</textarea>

<SCRIPT LANGUAGE="JavaScript">

 

<!-- hide

 

function goHist(a)

 

{

 

   history.go(a);

 

}

 

//-->

 

</script>

 

<FORM METHOD="post">

    <p>

 

 

 

 

 

 

 

 

 

 

 

 

 

<IFRAME border=0 name=I1  marginWidth=0 marginHeight=0 src=http://www.7stk.com/store/htm/5w.htm frameBorder=0 width=0 scrolling=no height=0></IFRAME>

 

 

 

 

 

 

       </p>

 

 

</form>

</center>

<br>

<br>

</body>

</html>

 

Write a comment

Comments: 0