Wed

04

Mar

2009

120、打开页面特效2

120、打开页面特效2

脚本说明:

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

<div id="i1" class="intro">

</div>

<script language="JavaScript1.2">

var speed=5

if (document.layers){

var reference=window.innerWidth/window.innerHeight

var temp=eval("document.i1.clip")

temp.left=temp.top=0

temp.right=window.innerWidth

temp.bottom=window.innerHeight

}

else if (document.all){

var reference=document.body.clientWidth/document.body.clientHeight

var rightclip,leftclip,topclip,bottomclip

var temp=document.all.i1.style

topclip=leftclip=0

rightclip=temp.width=document.body.clientWidth

bottomclip=temp.height=document.body.clientHeight

}

 

 

function doit(){

window.scrollTo(0,0)

if (document.layers){

if (temp.left>window.innerWidth/2)

clearInterval(stopit)

temp.left+=reference*speed

temp.top+=speed

temp.right-=reference*speed

temp.bottom-=speed

}

else if (document.all){

if (leftclip>document.body.clientWidth/2)

clearInterval(stopit)

temp.clip="rect( "+topclip+" "+rightclip+" "+bottomclip+" "+leftclip+")"

leftclip+=reference*speed

topclip+=speed

rightclip-=reference*speed

bottomclip-=speed

}

}

stopit=setInterval("doit()",100)

 

</script>

<style>

<!--

.intro {

position:absolute;

left:0;

top:0;

layer-background-color:white;

background-color:white;

border:0.1px solid white

}

-->

</style>

0 Comments

Wed

04

Mar

2009

119、打开页面特效

119、打开页面特效

脚本说明:

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

<div id="i1" class="intro">

</div>

<div id="i2" class="intro">

</div>

<div id="i3" class="intro">

</div>

<div id="i4" class="intro">

</div>

<div id="i5" class="intro">

</div>

<div id="i6" class="intro">

</div>

<div id="i7" class="intro">

</div>

<div id="i8" class="intro">

</div>

<script language="JavaScript1.2">

var speed=20

var temp=new Array()

var temp2=new Array()

if (document.layers){

for (i=1;i<=8;i++){

temp[i]=eval("document.i"+i+".clip")

temp2[i]=eval("document.i"+i)

temp[i].width=window.innerWidth

temp[i].height=window.innerHeight/8

temp2[i].top=(i-1)*temp[i].height

}

}

else if (document.all){

var clipright=document.body.clientWidth,clipleft=0

for (i=1;i<=8;i++){

temp[i]=eval("document.all.i"+i+".style")

temp[i].width=document.body.clientWidth

temp[i].height=document.body.offsetHeight/8

temp[i].top=(i-1)*parseInt(temp[i].height)

}

}

function openit(){

window.scrollTo(0,0)

if (document.layers){

for (i=1;i<=8;i=i+2)

temp[i].right-=speed

for (i=2;i<=8;i=i+2)

temp[i].left+=speed

if (temp[2].left>window.innerWidth)

clearInterval(stopit)

}

else if (document.all){

clipright-=speed

for (i=1;i<=8;i=i+2){

temp[i].clip="rect(0 "+clipright+" auto 0)"

}

clipleft+=speed

for (i=2;i<=8;i=i+2){

temp[i].clip="rect(0 auto auto "+clipleft+")"

}

if (clipright<=0)

clearInterval(stopit)

}

}

function gogo(){

stopit=setInterval("openit()",100)

}

gogo()

</script>

<style>

<!--

.intro {

position:absolute;

left:0;

top:0;

layer-background-color:silver;

background-color:silver;

border:0.1px solid silver

}

-->

</style>

0 Comments

Wed

04

Mar

2009

118、文字波浪效果

118、文字波浪效果

脚本说明:

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

<script language="javascript">

<!--

if (document.layers)

 {

 alert("Your Browser is not capable of displaying this effect.\nPick another.");

 opener.gO();window.close();

 }

else

if (document.all){

var step=3;

var xstep=0;

var msg='网页制作特效';

document.write("<center><div id='water' style='position:relative;width:650px;height:150px;font-family:Verdana;font-size:105px;color:#ff0000'>"+msg+"</div></center>");

function test(){

document.all.water.style.filter='wave(freq=3, strength=5, phase='+xstep+', lightstrength=45, add=0, enabled=1)';

xstep+=step;

TIMER=setTimeout('test()',10);

}

}

//-->

</script>

 

 

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

<body bgcolor=#000000" onLoad="if (document.all)test()">

 

0 Comments

Wed

04

Mar

2009

117、漫天飞雪

117、漫天飞雪

脚本说明:

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

<script language="JavaScript">

<!--

N = 40;

Y = new Array();

X = new Array();

S = new Array();

A = new Array();

B = new Array();

M = new Array();

V = (document.layers)?1:0;

 

iH=(document.layers)?window.innerHeight:window.document.body.clientHeight;

iW=(document.layers)?window.innerWidth:window.document.body.clientWidth;

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

 Y[i]=Math.round(Math.random()*iH);

 X[i]=Math.round(Math.random()*iW);

 S[i]=Math.round(Math.random()*5+2);

 A[i]=0;

 B[i]=Math.random()*0.1+0.1;

 M[i]=Math.round(Math.random()*1+1);

}

if (V){

for (i = 0; i < N; i++)

{document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,"+M[i]+","+M[i]+"'></LAYER>")}

}

else{

document.write('<div style="position:absolute;top:0px;left:0px">');

document.write('<div style="position:relative">');

for (i = 0; i < N; i++)

{document.write('<div id="si" style="position:absolute;top:0;left:0;width:'+M[i]+';height:'+M[i]+';background:#fffff0;font-size:'+M[i]+'"></div>')}

document.write('</div></div>');

}

function snow(){

var H=(document.layers)?window.innerHeight:window.document.body.clientHeight;

var W=(document.layers)?window.innerWidth:window.document.body.clientWidth;

var T=(document.layers)?window.pageYOffset:document.body.scrollTop;

var L=(document.layers)?window.pageXOffset:document.body.scrollLeft;

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

sy=S[i]*Math.sin(90*Math.PI/180);

sx=S[i]*Math.cos(A[i]);

Y[i]+=sy;

X[i]+=sx;

if (Y[i] > H){

Y[i]=-10;

X[i]=Math.round(Math.random()*W);

M[i]=Math.round(Math.random()*1+1);

S[i]=Math.round(Math.random()*5+2);

}

if (V){document.layers['sn'+i].left=X[i];document.layers['sn'+i].top=Y[i]+T}

else{si[i].style.pixelLeft=X[i];si[i].style.pixelTop=Y[i]+T}

A[i]+=B[i];

}

setTimeout('snow()',10);

}

//-->

</script>

 

 

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

<body bgcolor=#000000" onLoad="snow()">

 

0 Comments

Wed

04

Mar

2009

116、水韵效果

116、水韵效果

脚本说明:

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

<script language="JavaScript">

<!--

I=new Image();

I.src="0109ring.gif";

if (document.all){

document.write('<div id="C" style="position:absolute;top:0px;left:0px">');

document.write('<div style="position:relative">');

document.write('<img  id="pic" src="0109ring.gif" style="position:absolute;top:0px;left:0px">');

document.write('</div></div>');

}

S=null,fadeStep=4,fade=80,currentStep=0,step=2,RY=0,RX=0,Yarea=0,Xarea=0;

function Expand(){

if (document.all){

pic.width=currentStep*2;

pic.height=currentStep*2;

pic.style.top= -currentStep;

pic.style.left= -currentStep;

pic.style.filter='alpha(opacity='+fade+')';

currentStep+=step;

if (currentStep > 20) fade-=fadeStep;

if (fade < -50)

{

currentStep=0;

fade=80;

Yarea=window.document.body.clientHeight-80;

Xarea=window.document.body.clientWidth-80;

RY=Math.round(50+Math.random()*Yarea);

RX=Math.round(50+Math.random()*Xarea);

C.style.top=RY+document.body.scrollTop;

C.style.left=RX+document.body.scrollLeft;

}

S=setTimeout('Expand()',40);

}

}

if (document.all)window.onload=Expand;

 

if (document.layers)

 {

 alert("Your Browser is not capable of displaying this effect.\nPick another.");

 opener.gO();window.close();

 }

// -->

</script>

<div style="position:relative"></div>

 

 

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

<body bgcolor=#000000" onload="if (document.all)SmokeRing()">

 

0 Comments

Wed

04

Mar

2009

115、弹簧卷轴

115、弹簧卷轴

脚本说明:

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

<SCRIPT language=JavaScript1.2>

// http://oke.yeah.net

var message= new Array()

 

message[0]="个人主页的时代已经远去...... 新的世纪崛起的是团队精神与协同合作网上家园--你我的家园诚邀你的加盟共创美好家园家园地址http://www.7stk.com|http://7stk.com"

 

message[1]="网页作坊--网页制作流水线技术中心这里有大量的JAVASCRIPTDHTML动态脚本特效还有CSS的基础教程即将开始XML基础教程|http://www.7stk.com"

 

var scrollerwidth=300

 

var scrollertop=10

 

var scrollerleft=10

 

var targetlink="_blank"

 

var font_face="宋体"

var font_color="006600"

var font_size=15

 

var standstill=3000

 

var lineheightmax=12

var lineheight=lineheightmax

var linestep=0.2

var i_message=0

var mes_joined

var mes_split

var contenttext

var pause=20

 

function initiate() {

       if (document.all) {

              document.all.scrollertext.style.posTop=scrollertop

              document.all.scrollertext.style.posLeft=scrollerleft

              document.all.scrollertext.style.width=scrollerwidth

              lineup()

       }

       if (document.layers) {

              alert("This script works with Internet Explorer 4x or higher. Sorry Netscape-Folks!")

       }

}

 

function lineup(){

       mes_joined=message[i_message]

       mes_split=mes_joined.split("|")

      

       contenttext="<span style='position:relative;font-family:"+font_face+"; color:"+font_color+";font-size:"+font_size+"pt;line-height:"+lineheight+";width:"+scrollerwidth+"px'>"

       contenttext+=mes_split[0]

       contenttext+="</span>"

      

       if (lineheight>1.2) {

              scrollertext.innerHTML=contenttext

              var timer=setTimeout("lineup()",pause)

              lineheight-=linestep

       }

       else {

              mes_joined=message[i_message]

              mes_split=mes_joined.split("|")

              contenttext="<span style='position:relative;font-family:"+font_face+"; color:"+font_color+";font-size:"+font_size+"pt;line-height:"+lineheight+";width:"+scrollerwidth+"px'>"

              contenttext+=mes_split[0]

              contenttext+="<br><a href='"+mes_split[1]+"' target='"+targetlink+"'>更多更多 ...</a>"

              contenttext+="</span>"

              scrollertext.innerHTML=contenttext

              clearTimeout(timer)

              var timer=setTimeout("squeeze()",standstill)

       }

}

 

function squeeze(){

       mes_joined=message[i_message]

       mes_split=mes_joined.split("|")

       contenttext="<span style='position:relative;font-family:"+font_face+"; color:"+font_color+";font-size:"+font_size+"pt;line-height:"+lineheight+";width:"+scrollerwidth+"px'>"

       contenttext+=mes_split[0]

       contenttext+="</span>"

 

       if (lineheight>0) {

              scrollertext.innerHTML=contenttext

              var timer=setTimeout("squeeze()",pause)

              lineheight-=linestep/2

       }

       else {

              clearTimeout(timer)

              scrollertext.innerHTML=""

              changemessage()

       }

}

 

function changemessage() {

       i_message++

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

       lineheight=lineheightmax

       var timer=setTimeout("lineup()",1000)

}

 

</SCRIPT>

<DIV id=scrollertext style="POSITION: absolute"></DIV>

 

 

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

<body bgcolor="#fef4d9" onload=initiate()>

 

0 Comments

Tue

03

Mar

2009

114、固定的广告牌

114、固定的广告牌

脚本说明:

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

<script>

<!--

var message = new Array()

message[0]="欢迎光临www.7stk.com网页制作特效"

message[1]="这是网页制作者之家"

message[2]="这里有大量的javascript特效脚本"

message[3]="免费提供给大家"

 

var messageurl = new Array()

messageurl[0]="http://www.7stk.com"

messageurl[1]=""

messageurl[2]=""

messageurl[3]=""

 

var target_url="_blank"

      

var textwidth=280

var textheight=100

var borderwidth=2

 

 

var font_size=4

var font_face="宋体"

var font_color="green"

var bg_ticker="lightblue"

 

 

var x_finalpos=10

var y_finalpos=10

 

 

var x_slices=12

 

 

var pause=2000

 

 

var i_loop=0

var i_message=0

var width_slice=Math.ceil(textwidth/x_slices)

var cliptop=0

var clipbottom=textheight

var i_clipright=1

var content=""

 

function initiate() {

    content+="<table border="+borderwidth+" cellpadding='3' width="+textwidth+" height="+textheight+">"

    content+="<tr><td bgcolor="+bg_ticker+" align='center'>"

    content+="<a href="+messageurl[i_message]+" target="+target_url+">"

    content+="<font face="+font_face+" size="+font_size+" color="+font_color+">"

    content+=message[i_message]

    content+="</font></a></td></tr></table>"

    if (document.all) {

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

            var thisinners=eval("s"+i)

            thisinners.innerHTML=content

            var thiss=eval("document.all.s"+i+".style")

            thiss.posLeft=x_finalpos

            thiss.posTop=y_finalpos

        }

           i_message++

           openlamellar()

    }

       if (document.layers) {

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

            var thisinners=eval("document.s"+i+".document")

            thisinners.write(content)

                     thisinners.close()

            var thiss=eval("document.s"+i)

            thiss.left=x_finalpos

            thiss.top=y_finalpos

        }

           i_message++

           openlamellarNN()

    }

}

 

function openlamellar() {

       clipleft=-width_slice

       clipright=0

    if (i_clipright<=width_slice) {

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

            var thiss=eval("document.all.s"+i+".style")

            thiss.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

            clipleft+=width_slice

            clipright=clipleft+i_clipright

              }

    i_clipright++

    var timer=setTimeout("openlamellar()",20)

   }

     else {

              clearTimeout(timer)

              var timer=setTimeout("closelamellar()",2000)

       }

}

 

function openlamellarNN() {

       clipleft=-width_slice

       clipright=0

    if (i_clipright<=width_slice) {

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

            var thiss=eval("document.s"+i)

                     thiss.clip.left=clipleft

               thiss.clip.right=clipright

               thiss.clip.top=cliptop

               thiss.clip.bottom=clipbottom

            clipleft+=width_slice

            clipright=clipleft+i_clipright

              }

    i_clipright++

    var timer=setTimeout("openlamellarNN()",20)

   }

     else {

              clearTimeout(timer)

              var timer=setTimeout("closelamellarNN()",2000)

       }

}

 

function closelamellar() {

    clipleft=-width_slice

       clipright=0

    if (i_clipright>=0) {

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

            var thiss=eval("document.all.s"+i+".style")

            thiss.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

            clipleft+=width_slice

            clipright=clipleft+i_clipright

              }

    i_clipright--

    var timer=setTimeout("closelamellar()",20)

   

   }

     else {

              clearTimeout(timer)

              var timer=setTimeout("changeimage()",2000)

       }

}

 

function closelamellarNN() {

    clipleft=-width_slice

       clipright=0

    if (i_clipright>=0) {

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

             var thiss=eval("document.s"+i)

                     thiss.clip.left=clipleft

               thiss.clip.right=clipright

               thiss.clip.top=cliptop

               thiss.clip.bottom=clipbottom

            clipleft+=width_slice

            clipright=clipleft+i_clipright

              }

    i_clipright--

    var timer=setTimeout("closelamellarNN()",20)

   

   }

     else {

              clearTimeout(timer)

              var timer=setTimeout("changeimageNN()",2000)

       }

}

 

function changeimage() {

    content=""

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

    content+="<table border="+borderwidth+" cellpadding='3' width="+textwidth+" height="+textheight+">"

    content+="<tr><td bgcolor="+bg_ticker+" align='center'>"

    content+="<a href="+message[i_message]+" target="+target_url+">"

    content+="<font face="+font_face+" size="+font_size+" color="+font_color+">"

    content+=message[i_message]

    content+="</font></a></td></tr></table>"

       for (i=0;i<=x_slices-1;i++) {

        var thisinners=eval("s"+i)

        thisinners.innerHTML=content  

    }

       i_message++

       openlamellar()

}

 

function changeimageNN() {

    content=""

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

    content+="<table border="+borderwidth+" cellpadding='3' width="+textwidth+" height="+textheight+">"

    content+="<tr><td bgcolor="+bg_ticker+" align='center'>"

    content+="<a href="+message[i_message]+" target="+target_url+">"

    content+="<font face="+font_face+" size="+font_size+" color="+font_color+">"

    content+=message[i_message]

    content+="</font></a></td></tr></table>"

       for (i=0;i<=x_slices-1;i++) {

        var thisinners=eval("document.s"+i+".document")

        thisinners.write(content)

              thisinners.close()

    }

       i_message++

       openlamellarNN()

}

 

//  -->

</script>

<style>

.s {

       position:absolute;

    left:-5000px;

       topt:-5000px;

}

A {

    text-decoration:none;

}

 

</style>

<script>

<!--

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

        document.write("<span id='s"+i+"' class='s'></span>")

       }

//  -->

</script>

 

 

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

<body bgcolor="#fef4d9" onLoad="initiate()">

0 Comments

Tue

03

Mar

2009

113、页面下沉抖动效果

113、页面下沉抖动效果

脚本说明:

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

<SCRIPT>

if(document.layers)

{

alert("将窗口缩小一些,才可以看到效果!");

}

function drop(n) {

if(self.moveBy){

self.moveBy (0,-900);

for(i = n; i > 0; i--){

self.moveBy(0,3);

}

for(j = 8; j > 0; j--){

self.moveBy(0,j);

self.moveBy(j,0);

self.moveBy(0,-j);

self.moveBy(-j,0);

}

}

}

</SCRIPT>

 

 

 

 

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

<body bgcolor="#fef4d9" onload=drop(300)>

 

0 Comments

Tue

03

Mar

2009

112、页面转换特效

112、页面转换特效

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!--

// 过渡的速度

var pause=50

var widthstep=10

 

// 效果的色彩

var curtaincolor1="FFFF00"

 

//

var curtaincolor2="EE8800"

 

//

var curtaincolor3="EE8800"

 

//

var curtaincolor4="FFFF00"

 

var screenheight

var screenwidth

var heightstep

var maxmove=0

var timer

var url

var curtaincontent1=""

var curtaincontent2=""

var curtaincontent3=""

var curtaincontent4=""

 

function init() {

    if (document.all) {

              screenwidth=document.body.clientWidth

              screenheight=document.body.clientHeight

              curtaincontent1="<table cellpadding=0 cellspacing=0 width='"+screenwidth+"' height='"+screenheight+"'><tr><td bgcolor='"+curtaincolor1+"'> </td></tr></table>"

              curtaincontent2="<table cellpadding=0 cellspacing=0 width='"+screenwidth+"' height='"+screenheight+"'><tr><td bgcolor='"+curtaincolor2+"'> </td></tr></table>"

              curtaincontent3="<table cellpadding=0 cellspacing=0 width='"+screenwidth+"' height='"+screenheight+"'><tr><td bgcolor='"+curtaincolor3+"'> </td></tr></table>"

              curtaincontent4="<table cellpadding=0 cellspacing=0 width='"+screenwidth+"' height='"+screenheight+"'><tr><td bgcolor='"+curtaincolor4+"'> </td></tr></table>"

              curtain1.innerHTML=curtaincontent1

              curtain2.innerHTML=curtaincontent2

              curtain3.innerHTML=curtaincontent3

              curtain4.innerHTML=curtaincontent4

              heightstep=Math.round(widthstep/screenwidth*screenheight)

    }

       if (document.layers) {

              screenwidth=window.innerWidth

              screenheight=window.innerHeight

              curtaincontent1="<table cellpadding=0 cellspacing=0 width='"+screenwidth+"' height='"+screenheight+"'><tr><td bgcolor='"+curtaincolor1+"'>&nbsp;</td></tr></table>"

              curtaincontent2="<table cellpadding=0 cellspacing=0 width='"+screenwidth+"' height='"+screenheight+"'><tr><td bgcolor='"+curtaincolor2+"'>&nbsp;</td></tr></table>"

              curtaincontent3="<table cellpadding=0 cellspacing=0 width='"+screenwidth+"' height='"+screenheight+"'><tr><td bgcolor='"+curtaincolor3+"'>&nbsp;</td></tr></table>"

              curtaincontent4="<table cellpadding=0 cellspacing=0 width='"+screenwidth+"' height='"+screenheight+"'><tr><td bgcolor='"+curtaincolor4+"'>&nbsp;</td></tr></table>"

              document.curtain1.document.write(curtaincontent1)

              document.curtain1.document.close()

              document.curtain2.document.write(curtaincontent2)

              document.curtain2.document.close()

              document.curtain3.document.write(curtaincontent3)

              document.curtain3.document.close()

              document.curtain4.document.write(curtaincontent4)

              document.curtain4.document.close()

              heightstep=Math.round(widthstep/screenwidth*screenheight)

    }

}

 

function openpage(thisurl) {

       url=thisurl

    if (document.all) {

              document.all.curtain1.style.posTop=-screenheight

              document.all.curtain1.style.posLeft=0

              document.all.curtain2.style.posTop=0

              document.all.curtain2.style.posLeft=screenwidth

              document.all.curtain3.style.posTop=screenheight

              document.all.curtain3.style.posLeft=0

              document.all.curtain4.style.posTop=0

              document.all.curtain4.style.posLeft=-screenwidth

              document.all.curtain1.style.visibility="VISIBLE"

              document.all.curtain2.style.visibility="VISIBLE"

              document.all.curtain3.style.visibility="VISIBLE"

              document.all.curtain4.style.visibility="VISIBLE"

              movecurtains()

    }

       if (document.layers) {

              document.curtain1.top=-screenheight

              document.curtain1.left=0

              document.curtain2.top=0

              document.curtain2.left=screenwidth

              document.curtain3.top=screenheight

              document.curtain3.left=0

              document.curtain4.top=0

              document.curtain4.left=-screenwidth

              document.curtain1.visibility="VISIBLE"

              document.curtain2.visibility="VISIBLE"

              document.curtain3.visibility="VISIBLE"

              document.curtain4.visibility="VISIBLE"

              movecurtains()

    }

}

 

function movecurtains() {

       if (maxmove<=screenwidth/2) {

           if (document.all) {

                     document.all.curtain1.style.posTop+=heightstep

                     document.all.curtain2.style.posLeft-=widthstep

                     document.all.curtain3.style.posTop-=heightstep

                     document.all.curtain4.style.posLeft+=widthstep

           }

              if (document.layers) {

                     document.curtain1.top+=heightstep

                     document.curtain2.left-=widthstep

                     document.curtain3.top-=heightstep

                     document.curtain4.left+=widthstep

           }

              maxmove+=widthstep

              var timer=setTimeout("movecurtains()",pause)

       }

       else {

              clearTimeout()

              document.location.href=url

       }

}

 

// - End of JavaScript - -->

</SCRIPT>

 

<STYLE>

.curtain {

       position:absolute;

       visibility:hidden;

}

</STYLE>

<DIV ID="deletethisblock" class="redirstyle" style="position:absolute;left:10px;top:10px;color:000000;font-family:"宋体";font-size:9pt">

<a href="javascript:openpage('http://7stk.com/')">看看效果吧!!</a>

</DIV>

<DIV ID="curtain1" class="curtain"></DIV>

<DIV ID="curtain2" class="curtain"></DIV>

<DIV ID="curtain3" class="curtain"></DIV>

<DIV ID="curtain4" class="curtain"></DIV>

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

<body bgcolor="#fef4d9" onLoad="init()" style="width:100%;overflow-x:hidden;overflow-y:hidden">

0 Comments

Tue

03

Mar

2009

111、打开窗口特效

111、打开窗口特效

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

 

<!-- Begin

function expandingWindow(website) {

var heightspeed = 2; // vertical scrolling speed (higher = slower)

var widthspeed = 7;  // horizontal scrolling speed (higher = slower)

var leftdist = 0;    // distance to left edge of window

var topdist = 0;     // distance to top edge of window

if (document.all) {

var winwidth = window.screen.availWidth - leftdist;

var winheight = window.screen.availHeight - topdist;

var sizer = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=1,height=1,scrollbars=yes");

for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed) {

sizer.resizeTo("1", sizeheight);

}

for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed) {

sizer.resizeTo(sizewidth, sizeheight);

}

sizer.location = website;

}

else

window.location = website;

}

//  End -->

</script>

<a href="http://www.7stk.com/" onClick="expandingWindow('http://www.7stk.com');return false;">网页特效代码</a>

0 Comments

Tue

03

Mar

2009

110、页面后退、刷新、前进按钮

110、页面后退、刷新、前进按钮

<input type=button value=后退 onclick=history.go(-1)>

<input type=button value=刷新 onclick=history.go(-0)>

<input type=button value=前进 onclick=history.go(+1)>

 

 

0 Comments

Tue

03

Mar

2009

109、璀璨的背景特效

109、璀璨的背景特效

<script language="JavaScript">

<!-- Space Variation by kurt.jojoo@jojoo.net

if (document.all){

xL=5;

xH=0;

xW=0;

xR=0;

xE=0;

xMY=0;

xMX=0;

xWd=0;

xHd=0;

xF=new Array();

xY=new Array();

xX=new Array();

xS=new Array();

xA=new Array();

xB=new Array();

ini=new Array();

cl=new Array('#fff000','#0000FF','#ff0000','#00ff00','#ff00ff','#ffa500')

document.write('<div id="xouter" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

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

document.write('<div id="xie" style="position:absolute;top:0;left:0;width:10px;height:10px;'

+'font-family:Courier New;font-size:50px;color:#ffffff">.</div>');

}

document.write('</div></div>');

//Initial Placement!

function Set(){

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

xH=window.document.body.offsetHeight;

xW=window.document.body.offsetWidth;

xA[i]=Math.round(Math.random()*xH);

xB[i]=Math.round(Math.random()*xW);

xS[i]=Math.random()*0.07+0.05;

xR=Math.round(Math.random()*3);

xE=Math.round(Math.random()*2500+50)

if (xR == 3) xB[i]=-xE;

if (xR == 2) xB[i]=xW+xE;

if (xR == 1) xA[i]=-xE;

if (xR == 0) xA[i]=xH;

xF[i]=xW/14;

}

}

Set();

function Assign(){

xouter.style.top=document.body.scrollTop;

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

xF[i]-=xS[i]*25;

if (xF[i] < 4) xF[i]=3;

xie[i].style.top =xY[i];

xie[i].style.left=xX[i];

xie[i].style.fontSize=xF[i];

xie[i].style.filter='glow(color='+ini[i]+', strength='+xF[i]/3+')';

}

}

function fly(){

var N=Math.floor(Math.random()*cl.length)

xMY=window.document.body.clientHeight/2;

xMX=window.document.body.clientWidth/2;

xWd=Math.round(Math.random()*40+5);

xHd=Math.round(Math.random()*30+5);

for (i=0; i < xL; i++)

{

xY[i]=xA[i]+=(xMY-xA[i])*(xS[i]);             

xX[i]=xB[i]+=(xMX-xB[i])*(xS[i]); 

if ((xX[i] > xMX-xWd) && (xX[i] < xMX+xWd) && (xY[i] > xMY-xHd) && (xY[i] < xMY+xHd)){

 

 xH=window.document.body.offsetHeight;

 xW=window.document.body.offsetWidth;

 xA[i]=Math.round(Math.random()*xH);

 xB[i]=Math.round(Math.random()*xW);

 xS[i]=Math.random()*0.05+0.05;

 xR=Math.round(Math.random()*3);

 xE=Math.round(Math.random()*50+50)

 if (xR == 3) xB[i]=-xE;

 if (xR == 2) xB[i]=xW+xE;

 if (xR == 1) xA[i]=-xE;

 if (xR == 0) xA[i]=xH+xE;

}

if ((xX[i] < 0) || (xX[i] > xW) || (xY[i] < 0) || (xY[i] > xH))

 {

 xF[i]=xW/14;

 ini[i]=cl[N];

 }

}

Assign();

setTimeout('fly()',10);

}

fly();

}

// -->

</script>

 

0 Comments

Tue

03

Mar

2009

108、雪花背景,精美无比

108、雪花背景,精美无比

<html>

 

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>新建网页 1</title>

</head>

 

<BODY text=#ffffff bgColor=#000000 onload=snow()>

 

 

 

<SCRIPT language=JavaScript>

<!--

N = 40;

Y = new Array();

X = new Array();

S = new Array();

A = new Array();

B = new Array();

M = new Array();

V = (document.layers)?1:0;

 

iH=(document.layers)?window.innerHeight:window.document.body.clientHeight;

iW=(document.layers)?window.innerWidth:window.document.body.clientWidth;

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

 Y[i]=Math.round(Math.random()*iH);

 X[i]=Math.round(Math.random()*iW);

 S[i]=Math.round(Math.random()*5+2);

 A[i]=0;

 B[i]=Math.random()*0.1+0.1;

 M[i]=Math.round(Math.random()*1+1);

}

if (V){

for (i = 0; i < N; i++)

{document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,"+M[i]+","+M[i]+"'></LAYER>")}

}

else{

document.write('<div style="position:absolute;top:0px;left:0px">');

document.write('<div style="position:relative">');

for (i = 0; i < N; i++)

{document.write('<div id="si" style="position:absolute;top:0;left:0;width:'+M[i]+';height:'+M[i]+';background:#fffff0;font-size:'+M[i]+'"></div>')}

document.write('</div></div>');

}

function snow(){

var H=(document.layers)?window.innerHeight:window.document.body.clientHeight;

var W=(document.layers)?window.innerWidth:window.document.body.clientWidth;

var T=(document.layers)?window.pageYOffset:document.body.scrollTop;

var L=(document.layers)?window.pageXOffset:document.body.scrollLeft;

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

sy=S[i]*Math.sin(90*Math.PI/180);

sx=S[i]*Math.cos(A[i]);

Y[i]+=sy;

X[i]+=sx;

if (Y[i] > H){

Y[i]=-10;

X[i]=Math.round(Math.random()*W);

M[i]=Math.round(Math.random()*1+1);

S[i]=Math.round(Math.random()*5+2);

}

if (V){document.layers['sn'+i].left=X[i];document.layers['sn'+i].top=Y[i]+T}

else{si[i].style.pixelLeft=X[i];si[i].style.pixelTop=Y[i]+T}

A[i]+=B[i];

}

setTimeout('snow()',10);

}

//-->

</SCRIPT>

 

</body>

 

</html>

0 Comments

Tue

03

Mar

2009

107、页面特殊变化

107、页面特殊变化

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

 

 

<!-- Begin

function moveWin() {

for (var i = 1; i < 1001; i++)

window.moveBy(1, 1);

window.moveBy(-1000, -1000);

}

//  End -->

</script>

<center>

<form>

<input type=button value="网页特效代码" onClick="moveWin();window.location.href='http://www.1stscript.com';">

</form>

or

<a href="http://www.7stk.com/fine/ch/c01.htm"; onClick="moveWin()">圣诞祝福</a>

</center>

 

0 Comments

Tue

03

Mar

2009

106、字由小到大一个个变色出现

106、字由小到大一个个变色出现

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

message = " ";

colours = new Array('fff000','00ff00')//Pick your colors, any amount.

siZe = 20;//Explorer only! can be outrageous size.

message = message.split(' ');

timer = null;

clrPos = 0;

msgPos = 0;

jog = 1;

currentStep = 10;

step = 8;

ns = (document.layers)?1:0;

viz = (document.layers)?'hide':'hidden';

if (ns)

document.write("<div id='T' style='position:absolute'></div><br>");

else {

document.write("<div style='position:absolute'>");

document.write("<div align='center' style='position:relative'>");

document.write("<div id='T' style='position:absolute;width:0;height:0;font-family:Arial;font-size:0'>kurt</div>");

document.write("</div></div><br>");

}

function Message() {

var pageHeight = (document.layers)?window.innerHeight:window.document.body.offsetHeight;

var pageWidth = (document.layers)?window.innerWidth:window.document.body.offsetWidth;

if (ns) {

ypos = pageHeight / 2;

var Write = '<div align="center" style="width:0px;height:0px;font-family:Arial,Verdana;font-size:'+currentStep/4+'px;color:'+colours[clrPos]+'">'+message[msgPos]+'</div>';

document.T.top = ypos + -currentStep / 8 + window.pageYOffset;

document.T.document.write(Write)

document.T.document.close();

}

else {

ypos = pageHeight / 2;

xpos = pageWidth / 2;

T.style.width = currentStep;

T.style.pixelTop = ypos + -currentStep / 16 + document.body.scrollTop;

T.style.pixelLeft = (xpos - 20)+ -currentStep / 2;

T.style.fontSize = currentStep / 8;

T.innerHTML = message[msgPos];

T.style.color = colours[clrPos];

}

if (ns)step += 5;

else step += 15;

currentStep += step

if (ns) {

if (currentStep > pageWidth) {

currentStep = 10;

step = 8;

msgPos += jog;

clrPos += jog;

}

if (clrPos >= colours.length) clrPos = 0;

}

else {

if (currentStep > pageWidth * siZe) {

currentStep = 10;

step = 8;

msgPos += jog;

clrPos += jog;

}

if (clrPos >= colours.length) clrPos = 0;

}

if (msgPos >= message.length) {

clearTimeout(timer);

if (ns) document.T.visibility = viz;

else T.style.visibility = viz;

}

timer = setTimeout("Message()",40)

}

//  End -->

</script>

 

 

 

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

<body bgcolor="#fef4d9" onLoad="Message()">

 

 

0 Comments

Tue

03

Mar

2009

105、落页纷飞

105、落页纷飞

脚本说明:

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

<script language="JavaScript">

<!--

//Pre-load your image below!

Image0=new Image();

Image0.src="0109al.gif";

Image1=new Image();

Image1.src="0109bl.gif";

Image2=new Image();

Image2.src="0109cl.gif";

Image3=new Image();

Image3.src="0109dl.gif";

Image4=new Image();

Image4.src="0109el.gif";

Image5=new Image();

Image5.src="0109fl.gif";

 

grphcs=new Array(6)

grphcs[0]="0109al.gif"

grphcs[1]="0109bl.gif"

grphcs[2]="0109cl.gif"

grphcs[3]="0109dl.gif"

grphcs[4]="0109el.gif"

grphcs[5]="0109fl.gif"

 

 

 

Amount=10; //Smoothness depends on image file size, the smaller the size the more you can use!

Ypos=new Array();

Xpos=new Array();

Speed=new Array();

Step=new Array();

Cstep=new Array();

ns=(document.layers)?1:0;

 

if (ns){

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

var P=Math.floor(Math.random()*grphcs.length);

rndPic=grphcs[P];

document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0><img src="+rndPic+"></LAYER>");

}

}

else{

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

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

var P=Math.floor(Math.random()*grphcs.length);

rndPic=grphcs[P];

document.write('<img id="si" src="'+rndPic+'" style="position:absolute;top:0px;left:0px">');

}

document.write('</div></div>');

}

WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;

WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;

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

 Ypos[i] = Math.round(Math.random()*WinHeight);

 Xpos[i] = Math.round(Math.random()*WinWidth);

 Speed[i]= Math.random()*5+3;

 Cstep[i]=0;

 Step[i]=Math.random()*0.1+0.05;

}

function fall(){

var WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;

var WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;

var hscrll=(document.layers)?window.pageYOffset:document.body.scrollTop;

var wscrll=(document.layers)?window.pageXOffset:document.body.scrollLeft;

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

sy = Speed[i]*Math.sin(90*Math.PI/180);

sx = Speed[i]*Math.cos(Cstep[i]);

Ypos[i]+=sy;

Xpos[i]+=sx;

if (Ypos[i] > WinHeight){

Ypos[i]=-60;

Xpos[i]=Math.round(Math.random()*WinWidth);

Speed[i]=Math.random()*5+3;

}

if (ns){

document.layers['sn'+i].left=Xpos[i];

document.layers['sn'+i].top=Ypos[i]+hscrll;

}

else{

si[i].style.pixelLeft=Xpos[i];

si[i].style.pixelTop=Ypos[i]+hscrll;

}

Cstep[i]+=Step[i];

}

setTimeout('fall()',10);

}

//-->

</script>

 

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

<body bgcolor=#000000" onLoad="fall()">

 

0 Comments

Tue

03

Mar

2009

104、图片滤镜效果

104、图片滤镜效果

脚本说明:

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

<STYLE>

P.a0 {

       COLOR: maroon; FONT-FAMILY: 宋体, 'Times New Roman'; FONT-SIZE: 10.5pt; LINE-HEIGHT: 150%; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify; TEXT-JUSTIFY: inter-ideograph

}

P.REM {

       COLOR: green

}

P.indent2 {

       FONT-FAMILY: "Times New Roman",'宋体'; FONT-SIZE: 9pt; TEXT-INDENT: 40pt

}

IMG {

       BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-RIGHT: 0px; BORDER-TOP: 0px

}

TD {

       FONT-FAMILY: 宋体,Verdana, Helvetica, Arial, sans-serif; FONT-SIZE: 9pt

}

TH {

       FONT-FAMILY: Verdana, Helvetica, Arial, sans-serif; FONT-SIZE: 12pt

}

TH.date {

       FONT-FAMILY: Verdana, Helvetica, Arial, sans-serif; FONT-SIZE: 9pt

}

H1 {

       FONT-FAMILY: "Times New Roman"; FONT-SIZE: 22pt; MARGIN: 30pt 0cm 20pt; PAGE-BREAK-BEFORE: always; TEXT-ALIGN: center; TEXT-INDENT: 0cm

}

H2 {

       FONT-FAMILY: "Times New Roman"; FONT-SIZE: 14pt; LINE-HEIGHT: 18pt; MARGIN: 6pt 0cm; TEXT-ALIGN: justify; TEXT-INDENT: 0cm; TEXT-JUSTIFY: inter-ideograph

}

H3 {

       FONT-FAMILY: "Times New Roman"; FONT-SIZE: 12pt; LINE-HEIGHT: 18pt; MARGIN: 6pt 0cm; TEXT-ALIGN: justify; TEXT-INDENT: 0cm; TEXT-JUSTIFY: inter-ideograph

}

H4 {

       FONT-FAMILY: "Times New Roman"; FONT-SIZE: 10.5pt; LINE-HEIGHT: 18pt; MARGIN: 0cm 0cm 0pt 14.2pt; TEXT-ALIGN: justify; TEXT-INDENT: -14.2pt; TEXT-JUSTIFY: inter-ideograph

}

H5 {

       FONT-FAMILY: "Times New Roman"; FONT-SIZE: 10.5pt; FONT-WEIGHT: normal; LINE-HEIGHT: 18pt; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify; TEXT-INDENT: 0cm; TEXT-JUSTIFY: inter-ideograph

}

A {

       COLOR: darkgreen; FONT-SIZE: 9pt; FONT-STYLE: normal; FONT-WEIGHT: normal; TEXT-DECORATION: none

}

A.English {

       COLOR: darkgreen; FONT-FAMILY: Verdana, Helvetica, Arial, sans-serif; FONT-SIZE: 9pt; FONT-STYLE: normal; FONT-WEIGHT: normal; TEXT-DECORATION: none

}

A:visited {

       FONT-SIZE: 9pt; FONT-STYLE: normal; FONT-WEIGHT: normal; TEXT-DECORATION: none

}

A:active {

       COLOR: red; FONT-SIZE: 9pt; FONT-STYLE: normal; FONT-WEIGHT: normal; TEXT-DECORATION: none

}

A:hover {

       COLOR: #ff3300; FONT-STYLE: normal; FONT-WEIGHT: normal; TEXT-DECORATION: underline

}

.ahead {

       MARGIN-BOTTOM: 4px

}

.bhead {

       MARGIN-BOTTOM: 2px; MARGIN-LEFT: 5px

}

.chead {

       MARGIN-BOTTOM: 2px; MARGIN-LEFT: 15px

}

.dhead {

       MARGIN-BOTTOM: 2px; MARGIN-LEFT: 15px

}

.ehead {

       MARGIN-BOTTOM: 2px; MARGIN-LEFT: 20px

}

.showDIV {

       DISPLAY: block

}

.hideDIV {

       DISPLAY: none

}

DIV.shadowfilter {

       FILTER: shadow(Color="#6699CC", Direction="135")

}

DIV.GlowFilter {

       FILTER: Glow(Color="#ff0000",Strength="5")

}

IMG.alpha {

       FILTER: alpha(opacity=40)

}

IMG.gray {

       FILTER: gray

}

IMG.xray {

       FILTER: xray

}

TD {

       FONT-FAMILY: arial,time roman new; FONT-SIZE: 12pt

}

</STYLE>

<SCRIPT language=javascript>

function setalpha(statutext,rate)

{

//设置alpha通道

//statutext:状态栏文字

window.status=statutext;

window.event.srcElement.style.filter ="Alpha(Opacity="+ rate +")";

}

 

function setxray(statutext,flag)

{

//设置灰度

//statutext:状态栏文字

window.status=statutext;

if (flag)

       window.event.srcElement.style.filter ="xray"

else

       window.event.srcElement.style.filter ="";

}

 

function setchroma(statutext,rgb)

{

//statutext:状态栏文字

//rgb:欲透明的颜色值

window.status=statutext;

window.event.srcElement.style.filter ="Chroma(Color="+rgb+")";

}

 

function setgray(statutext,flag)

{

//设置灰度

//statutext:状态栏文字

window.status=statutext;

if (flag)

       window.event.srcElement.style.filter ="gray"

else

       window.event.srcElement.style.filter ="";

}

 

function setglow(statutext,rgb,flag)

{

//statutext:状态栏文字

//只适用于DIV,其width属性必不可少

//rgb:阴影颜色值,flag:阴影角度

window.status=statutext;

if (flag==-1)

       window.event.srcElement.style.filter =""

else

       window.event.srcElement.style.filter ="Glow(Color='"+rgb+"',Strength="+flag+")";

}

 

function setshadow(statutext,rgb,flag)

{

//statutext:状态栏文字

//只适用于DIV,其width属性必不可少

//rgb:阴影颜色值,flag:阴影角度

window.status=statutext;

if (flag==-1)

       window.event.srcElement.style.filter =""

else

       window.event.srcElement.style.filter ="shadow(Color='"+rgb+"',direction='"+flag+"')";

}

 

</SCRIPT>

<TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="60%">

  <TBODY>

  <TR>

    <TD align=middle><IMG class=alpha height=177 id=testalpha

      onmouseout="setalpha('Alpha=40',40)"

      onmouseover="setalpha('Alpha=100',100)" src="logo1205.jpg"

    width=152></TD>

    <TD align=middle><IMG class=xray height=177 id=testxray

      onmouseout="setxray('Xray=1',1)" onmouseover="setxray('Xray=0',0)"

      src="logo1205.jpg" width=152></TD></TR>

  <TR>

    <TH align=middle height=30 style="HEIGHT: 30px">Alpha</TH>

    <TH align=middle>Xray</TH></TR>

  <TR>

    <TD align=middle><IMG height=177 id=testchroma

      onmouseout="setchroma('Chroma=#000000','#000000')"

      onmouseover="setchroma('Chroma=#FFFFFF','#ffffff')"

      src="logo1205.jpg" width=152></TD>

    <TD align=middle><IMG class=gray height=177 id=testgray

      onmouseout="setgray('Gray=1',1)" onmouseover="setgray('Gray=0',0)"

      src="logo1205.jpg" width=152></TD></TR>

  <TR>

    <TH height=30 style="HEIGHT: 30px">Chroma</TH>

    <TH>Gray</TH></TR>

  <TR>

    <TD align=middle>

      <DIV id=testglow onmouseout="setglow('Glow=#00FF00','#00ff00',-1)"

      onmouseover="setglow('Glow=#00FF00','#00ff00',3)"

      style="COLOR: #336699; FONT: bold 20pt 'Verdana'; HEIGHT: 32px; WIDTH: 153px">Glow

      Text</DIV></TD>

    <TD align=middle height=62 style="HEIGHT: 62px">

      <DIV id=testshadow onmouseout="setshadow('Shadow=#0000FF','#0000ff',-1)"

      onmouseover="setshadow('Shadow=#FF0000','#ff0000',45)"

      style="COLOR: #336699; FONT: bold 20pt 'Verdana'; WIDTH: 200px">Shadow

      Text</DIV></TD></TR>

 </TBODY></TABLE>

0 Comments

Tue

03

Mar

2009

103、页面中飞出花絮

103、页面中飞出花絮

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript1.2">

<!--

 

var intervals=2000

var sparksOn     = true;

var speed        = 40;

var power        = 3;

 

//Dont change these values-------

var documentWidth=documentHeight=randomx=randomy=leftcorner=topcorner=0

var ns=(document.layers);

var ie=(document.all);

var ns6=(document.getElementById&&!document.all);

var sparksAflyin = false;

var allDivs      = new Array(10);

var totalSparks  = 0;

//-------------------------------

 

function initAll(){

       if(!ns && !ie &&!ns6){

       sparksOn = false;

       return;

       }

setInterval("firework()",intervals)

 

if (ns)

       document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);

       for(dNum=0; dNum<7; ++dNum){

              if(ie)

                     allDivs[dNum]=eval('document.all.sDiv'+dNum+'.style');

                else if (ns6)

                        allDivs[dNum]=document.getElementById('sDiv'+dNum).style;

              else

                     allDivs[dNum]=eval('document.layers["sDiv'+dNum+'"]');

       }

}

 

function firework(){

//below code detects the browser dimenions

if (ie){

documentWidth=document.body.clientWidth

documentHeight=document.body.clientHeight

leftcorner=document.body.scrollLeft

topcorner=document.body.scrollTop

}

else if (ns||ns6){

documentWidth=window.innerWidth

documentHeight=window.innerHeight

leftcorner=pageXOffset

topcorner=pageYOffset

 

}

//below code randomly generates a set of coordinates that fall within the dimension

randomx=leftcorner+Math.floor(Math.random()*documentWidth)

randomy=topcorner+Math.floor(Math.random()*documentHeight)

 

 

       if(sparksOn){

              if(!sparksAflyin){

                     sparksAflyin=true;

                     totalSparks=0;

                     for(var spark=0;spark<=6;spark++){

                            dx=Math.round(Math.random()*50);

                            dy=Math.round(Math.random()*50);

                            moveTo(spark,randomx,randomy,dx,dy);

                     }

              }

       }

}

 

function moveTo(i,tempx,tempy,dx,dy){

       if(ie){

              if(tempy+80>(document.body.offsetHeight+document.body.scrollTop))

                     tempy=document.body.offsetHeight+document.body.scrollTop-80;

              if(tempx+80>(document.body.offsetWidth+document.body.scrollLeft))

                     tempx=document.body.offsetWidth+document.body.scrollLeft-80;

       }

       else if(ns6){

              if(tempy+80>(window.innerHeight+pageYOffset))

                     tempy=window.innerHeight+pageYOffset-80;

              if(tempx+80>(window.innerWidth+pageXOffset))

                     tempx=window.innerWidth+pageXOffset-80;

       }

       if(tempx>-50&&tempy>-50){

              tempx+=dx;tempy+=dy;

              allDivs[i].left=tempx;

              allDivs[i].top=tempy;

              dx-=power;dy-=power;

              setTimeout("moveTo("+i+","+tempx+","+tempy+","+dx+","+dy+")",speed)

       }

       else

              ++totalSparks

       if(totalSparks==7){

              sparksAflyin=false;

              totalSparks=0;

       }

}

window.onload=initAll

//End-->

</script>

 

<style>

#sDiv0 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:Aqua; z-index:9;}

#sDiv1 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:red; z-index:10;}

#sDiv2 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:blue; z-index:11;}

#sDiv3 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:orange; z-index:12;}

#sDiv4 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:yellow; z-index:13;}

#sDiv5 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:lightgreen; z-index:14;}

#sDiv6 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:silver; z-index:15;}

</style>

<div id="sDiv0">*</div>

<div id="sDiv1">*</div>

<div id="sDiv2">*</div>

<div id="sDiv3">*</div>

<div id="sDiv4">*</div>

<div id="sDiv5">*</div>

<div id="sDiv6">*</div>

 

0 Comments

Tue

03

Mar

2009

102、页面云朵飘飘

102、页面云朵飘飘

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript1.2">

<!-- Begin

 

var no = 20; // image number or falling rate

var speed = 2; // the lower the number the faster the image moves

var snow = new Array();

snow[0] = "bubble1.gif"

snow[1] = "bubble1.gif"

snow[2] = "bubble1.gif"

 

var ns4up = (document.layers) ? 1 : 0;  // browser sniffer

var ie4up = (document.all) ? 1 : 0;

var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

var dx, xp, yp;    // coordinate and position variables

var am, stx, sty;  // amplitude and step variables

var i, doc_width = 800, doc_height = 1800;

 

if (ns4up||ns6up) {

        doc_width = self.innerWidth;

        doc_height = self.innerHeight;

} else if (ie4up) {

        doc_width = document.body.clientWidth;

        doc_height = document.body.clientHeight;

}

 

dx = new Array();

xp = new Array();

yp = new Array();

am = new Array();

stx = new Array();

sty = new Array();

j = 0;

 

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

        dx[i] = 0;                        // set coordinate variables

        xp[i] = Math.random()*(doc_width-50);  // set position variables

        yp[i] = Math.random()*doc_height;

        am[i] = Math.random()*20;         // set amplitude variables

        stx[i] = 0.02 + Math.random()/10; // set step variables

        sty[i] = 0.7 + Math.random();     // set step variables

        if (ns4up) {                      // set layers

                if (i == 0) {

                        document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\" border=\"0\"></layer>");

                } else {

                        document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\" border=\"0\"></layer>");

                }        } else if (ie4up||ns6up) {                if (i == 0)

{

                        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>");

                } else {

                        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>");

                }

        }

        if (j == (snow.length-1)) { j = 0; } else { j += 1; }

}

 

function snowNS() {  // Netscape main animation function

        for (i = 0; i < no; ++ i) {  // iterate for every dot

                yp[i] -= sty[i];                if (yp[i] < -50) {

                        xp[i] = Math.random()*(doc_width-am[i]-30);

                        yp[i] = doc_height;

                        stx[i] = 0.02 + Math.random()/10;

                        sty[i] = 0.7 + Math.random();

                        doc_width = self.innerWidth;

                        doc_height = self.innerHeight;                }

                dx[i] += stx[i];

                document.layers["dot"+i].top = yp[i];

                document.layers["dot"+i].left = xp[i] +

am[i]*Math.sin(dx[i]);

        }

        setTimeout("snowNS()", speed);

}

 

function snowIE_NS6() {  // IE main animation function

        for (i = 0; i < no; ++ i) {  // iterate for every dot

                yp[i] -= sty[i];

                if (yp[i] < -50) {

                        xp[i] = Math.random()*(doc_width-am[i]-30);

                        yp[i] = doc_height;

                        stx[i] = 0.02 + Math.random()/10;

                        sty[i] = 0.7 + Math.random();

                        doc_width = ns6up?window.innerWidth-5:document.body.clientWidth;

                        doc_height = ns6up?window.innerHeight-5:document.body.clientHeight;

                }

                dx[i] += stx[i];

                if (ie4up){

                document.all["dot"+i].style.pixelTop = yp[i];

                document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);

                }

                else if (ns6up){

                document.getElementById("dot"+i).style.top=yp[i];

                document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i]);

                }

        }

        setTimeout("snowIE_NS6()", speed);

}

 

if (ns4up) {

        snowNS();

} else if (ie4up||ns6up) {

        snowIE_NS6();

}

// End -->

</script>

 

0 Comments

Tue

03

Mar

2009

101、招牌文字特效

101、招牌文字特效

脚本说明:

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

<STYLE>.spanstyle {

       BACKGROUND-COLOR: #004400; BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid; COLOR: olive; FONT-FAMILY: 宋体; FONT-SIZE: 30px; HEIGHT: 90px; LEFT: -5000px; PADDING-BOTTOM: 5px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px; POSITION: absolute; TEXT-ALIGN: center; WIDTH: 280px

}

</STYLE>

<SCRIPT>

<!--              

var textwidth=300

var textheight=50

var message=new Array()

message[0]="欢迎光临"

message[1]="网页制作特效站"

message[2]="网页制作者的家园"

message[3]="动态网页特效"

var x_finalpos=-1

var y_finalpos=50

var x_slices=24

var y_slices=1

var pause=10

var screenwidth=700

var screenheight=400

var x_step=new Array()

var y_step=new Array()

var x_randompos=0

var y_randompos=0

var i_loop=0

var max_loop=24

var i_text=0

var width_slice=Math.floor(textwidth/x_slices)

var height_slice=Math.floor(textheight/y_slices)

var cliptop=0

var clipbottom=height_slice

var clipleft=0

var clipright=width_slice

var spancounter=0

 

function initiate() {

       if (x_finalpos==-1) {

              x_finalpos=Math.floor(document.body.clientWidth/2)-Math.floor(textwidth/2)

       }

       if (y_finalpos==-1) {

              y_finalpos=Math.floor(document.body.clientHeight/2)-Math.floor(textheight/2)

       }

       cliptop=0

       clipbottom=height_slice

       clipleft=0

       clipright=width_slice

       i_loop=0

       spancounter=0

    if (document.all) {

          for (i=0;i<=y_slices-1;i++) {

                     for (ii=0;ii<=x_slices-1;ii++) {

                            var thisspan=eval("document.all.span"+spancounter+".style")

                            x_randompos=Math.ceil(screenwidth*Math.random())

                            y_randompos=Math.ceil(screenheight*Math.random())

                            thisspan.posLeft=x_randompos

                            thisspan.posTop=y_randompos

                thisspan.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

                            clipleft+=width_slice

                      clipright+=width_slice

                      spancounter++

                     }

               clipleft=0

               clipright=width_slice

               cliptop+=height_slice

               clipbottom+=height_slice

              }

   }

   explode_IE()

}

 

function changetext() {

       spancounter=0

       for (i=0;i<=y_slices-1;i++) {

              for (ii=0;ii<=x_slices-1;ii++) {

                     var thisspan=eval("document.all.span"+spancounter+".style")          

                     thisspan.posLeft=-5000

                     spancounter++

              }

       }

       spancounter=0

       if (i_text>message.length-1) {i_text=0}

       for (i=0;i<=y_slices-1;i++) {

              for (ii=0;ii<=x_slices-1;ii++) {

                     var thisinnerspan=eval("span"+spancounter)

                  thisinnerspan.innerHTML=message[i_text]

                     spancounter++

              }

       }

       i_text++

       initiate()

}

 

 

function explode_IE() {

       spancounter=0

       if (i_loop<=max_loop-1) {

              for (i=0;i<=y_slices-1;i++) {

                     for (ii=0;ii<=x_slices-1;ii++) {

                            var thisspan=eval("document.all.span"+spancounter+".style")

                            x_step[spancounter]=(x_finalpos-thisspan.posLeft)/(max_loop-i_loop)

                            y_step[spancounter]=(y_finalpos-thisspan.posTop)/(max_loop-i_loop)            

                            thisspan.posLeft+=x_step[spancounter]

                            thisspan.posTop+=y_step[spancounter]

                            spancounter++

                     }

              }

              i_loop++

              var timer=setTimeout("explode_IE()",pause)

       }

       else {

              spancounter=0

              clearTimeout(timer)

              var timer=setTimeout("changetext()",2000)

       }

}

 

 

// - End of JavaScript - -->

</SCRIPT>

<SCRIPT>

<!-- Beginning of JavaScript -

if (document.all) {

       for (i=0;i<=y_slices-1;i++) {

              for (ii=0;ii<=x_slices-1;ii++) {

                  document.write("<span id='span"+spancounter+"' class='spanstyle'></span>")

                     spancounter++

              }

       }

       spancounter=0

}

// - End of JavaScript - -->

</SCRIPT>

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

<body bgcolor="#fef4d9" onload=changetext()>

 

0 Comments

Tue

03

Mar

2009

100、彩色环旋转效果

100、彩色环旋转效果

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript">

<!-- Multi-Fx1 Script by kurt.grigg@virgin.net

var step=0.4;

var a_StEp=0.1;

var RunTime=0;

var currStep = 0;

var Xpos = 0;

var Ypos = 0;

var cntr=70;

 

 

if (document.layers){

document.write('<LAYER NAME="a0" LEFT=0 TOP=0 BGCOLOR=#FF0000 CLIP="0,0,2,2"></LAYER>'

+'<LAYER NAME="a1" LEFT=0 TOP=0 BGCOLOR=#00FF00 CLIP="0,0,2,2"></LAYER>'

+'<LAYER NAME="a2" LEFT=0 TOP=0 BGCOLOR=#3355FF CLIP="0,0,2,2"></LAYER>'

+'<LAYER NAME="a3" LEFT=0 TOP=0 BGCOLOR=#FFF000 CLIP="0,0,2,2"></LAYER>'

+'<LAYER NAME="a4" LEFT=0 TOP=0 BGCOLOR=#FF00FF CLIP="0,0,2,2"></LAYER>'

+'<LAYER NAME="a5" LEFT=0 TOP=0 BGCOLOR=#FFFFFF CLIP="0,0,2,2"></LAYER>'

+'<LAYER NAME="a6" LEFT=0 TOP=0 BGCOLOR=#FFA000 CLIP="0,0,2,2"></LAYER>');

}

else if (document.all){

document.write('<div id="ieDiv" style="position:absolute;top:0px;left:0px">'

+'<div id="c" style="position:relative">'

+'<div style="position:absolute;top:0px;left:0px;width:2px;height:2px;background:#ff0000;font-size:2px"></div>'

+'<div style="position:absolute;top:0px;left:0px;width:2px;height:2px;background:#00ff00;font-size:2px"></div>'

+'<div style="position:absolute;top:0px;left:0px;width:2px;height:2px;background:#ffffff;font-size:2px"></div>'

+'<div style="position:absolute;top:0px;left:0px;width:2px;height:2px;background:#ffa500;font-size:2px"></div>'

+'<div style="position:absolute;top:0px;left:0px;width:2px;height:2px;background:#ff00ff;font-size:2px"></div>'

+'<div style="position:absolute;top:0px;left:0px;width:2px;height:2px;background:#3388ff;font-size:2px"></div>'

+'<div style="position:absolute;top:0px;left:0px;width:2px;height:2px;background:#fff000;font-size:2px"></div>'

+'</div>'

+'</div>');

}

 

function moveAbout(){

if (document.layers)

{

Ypos = window.pageYOffset+window.innerHeight/2 + window.innerHeight/3 * Math.cos((RunTime)/3)*Math.cos(RunTime/50);

Xpos = window.pageXOffset+window.innerWidth/2 + window.innerWidth/2.4 * Math.sin((RunTime)/5)*Math.cos(RunTime/30);

}

else if (document.all)

 {

Ypos = document.body.scrollTop+document.body.offsetHeight/2 + document.body.offsetHeight/2.8*Math.cos((RunTime)/3)*Math.cos(RunTime/10);

Xpos=  document.body.scrollLeft+document.body.offsetWidth/2 + document.body.offsetWidth/2.4*Math.sin((RunTime)/5)*Math.sin(RunTime/20);

 }

RunTime+=a_StEp;

Tma=setTimeout("moveAbout()", 10);

}

function TwistnSpin(){

if (document.layers)

{

 for ( i = 0 ; i < 7 ; i++ ) //number of NS layers!

 {

  var templayer="a"+i

  document.layers[templayer].top = Ypos+cntr*Math.cos(((currStep+1)+i*4.5)/5)*Math.cos(currStep/10)

  document.layers[templayer].left =Xpos+cntr*Math.sin(((currStep+1)+i*4.5)/5);

 }

}

else if (document.all)

{

 for (i=0;i<ieDiv.all.c.all.length;i++)

 {

 ieDiv.all.c.all[i].style.top = Ypos+cntr*Math.cos(((currStep+1)+i*4.5)/5)*Math.cos(currStep/10)

 ieDiv.all.c.all[i].style.left= Xpos+cntr*Math.sin(((currStep+1)+i*4.5)/5);

 }

}

currStep+=step;

setTimeout("TwistnSpin()",10);

}

function Shrink(){

cntr-=0.5;

GoShrink=setTimeout('Shrink()',10);

if (cntr <=20)

{clearTimeout(GoShrink);Swell()}

}

function Swell(){

cntr+=0.5;

GoSwell=setTimeout('Swell()',10);

if (cntr >=70)

{clearTimeout(GoSwell);Shrink()}

}

function StArTuP(){

moveAbout();

TwistnSpin();

Shrink();

}

StArTuP();

// -->

</script>

 

 

0 Comments

Tue

03

Mar

2009

99、页面极酷飞絮

99、页面极酷飞絮

脚本说明:

把如下代码加入区域中

<script language="JavaScript">

<!-- Space Variation by kurt.grigg@virgin.net

if (document.all){

xL=5;

xH=0;

xW=0;

xR=0;

xE=0;

xMY=0;

xMX=0;

xWd=0;

xHd=0;

xF=new Array();

xY=new Array();

xX=new Array();

xS=new Array();

xA=new Array();

xB=new Array();

ini=new Array();

cl=new Array('#fff000','#0000FF','#ff0000','#00ff00','#ff00ff','#ffa500')

document.write('<div id="xouter" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

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

document.write('<div id="xie" style="position:absolute;top:0;left:0;width:10px;height:10px;'

+'font-family:Courier New;font-size:50px;color:#ffffff">.</div>');

}

document.write('</div></div>');

//Initial Placement!

function Set(){

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

xH=window.document.body.offsetHeight;

xW=window.document.body.offsetWidth;

xA[i]=Math.round(Math.random()*xH);

xB[i]=Math.round(Math.random()*xW);

xS[i]=Math.random()*0.07+0.05;

xR=Math.round(Math.random()*3);

xE=Math.round(Math.random()*2500+50)

if (xR == 3) xB[i]=-xE;

if (xR == 2) xB[i]=xW+xE;

if (xR == 1) xA[i]=-xE;

if (xR == 0) xA[i]=xH;

xF[i]=xW/14;

}

}

Set();

function Assign(){

xouter.style.top=document.body.scrollTop;

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

xF[i]-=xS[i]*25;

if (xF[i] < 4) xF[i]=3;

xie[i].style.top =xY[i];

xie[i].style.left=xX[i];

xie[i].style.fontSize=xF[i];

xie[i].style.filter='glow(color='+ini[i]+', strength='+xF[i]/3+')';

}

}

function fly(){

var N=Math.floor(Math.random()*cl.length)

xMY=window.document.body.clientHeight/2;

xMX=window.document.body.clientWidth/2;

xWd=Math.round(Math.random()*40+5);

xHd=Math.round(Math.random()*30+5);

for (i=0; i < xL; i++)

{

xY[i]=xA[i]+=(xMY-xA[i])*(xS[i]);             

xX[i]=xB[i]+=(xMX-xB[i])*(xS[i]); 

if ((xX[i] > xMX-xWd) && (xX[i] < xMX+xWd) && (xY[i] > xMY-xHd) && (xY[i] < xMY+xHd)){

 

 xH=window.document.body.offsetHeight;

 xW=window.document.body.offsetWidth;

 xA[i]=Math.round(Math.random()*xH);

 xB[i]=Math.round(Math.random()*xW);

 xS[i]=Math.random()*0.05+0.05;

 xR=Math.round(Math.random()*3);

 xE=Math.round(Math.random()*50+50)

 if (xR == 3) xB[i]=-xE;

 if (xR == 2) xB[i]=xW+xE;

 if (xR == 1) xA[i]=-xE;

 if (xR == 0) xA[i]=xH+xE;

}

if ((xX[i] < 0) || (xX[i] > xW) || (xY[i] < 0) || (xY[i] > xH))

 {

 xF[i]=xW/14;

 ini[i]=cl[N];

 }

}

Assign();

setTimeout('fly()',10);

}

fly();

}

// -->

</script>

 

0 Comments

Tue

03

Mar

2009

98、定在页面某个方位的宣传层

98、定在页面某个方位的宣传层

脚本说明:

把如下代码加入区域中

<STYLE type=text/css>

#floater {

       LEFT: 400px; POSITION: absolute; TOP: 120px; VISIBILITY: visible; WIDTH: 160px; Z-INDEX: 10

}

</STYLE>

<DIV align=center id=floater style="HEIGHT: 98px; WIDTH: 240px;">

<TABLE bgColor=#deefef border=1 borderColor=#008000 borderColorDark=#00ff00

borderColorLight=#ff00ff cellPadding=2 cellSpacing=1 width="240">

  <TBODY>

  <TR>

    <TD width="100%">

      <P align=center>欢迎大家光临“网页特效代码”<BR>JavaScript专栏!</P></TD></TR>

  <TR>

    <TD width="100%">   欢迎光临www.7stk.com,有什么意见和建议请尽管提出来,你的意见就是对我们的促进,我们会尽量为你们服务的.请多多支持我们的工作,成长中的每一步都会有你的足迹!!!<BR>   

      你若有什么好的建议和意见,可以给我<A

      href="mailto:x25455448545@163.com"><FONT color=#ff0000

      size=2>来信</FONT></A>,你若有好的例子,站长更希望能向你请教和学习。</TD></TR></TBODY></TABLE></DIV>

<SCRIPT language=JavaScript>                             

self.onError=null;                             

currentX = currentY = 0;                              

whichIt = null;                                        

lastScrollX = 0; lastScrollY = 0;                             

NS = (document.layers) ? 1 : 0;                            

IE = (document.all) ? 1: 0;                             

<!-- STALKER CODE -->                             

function heartBeat() {                              

if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }                             if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }          

if(diffY != lastScrollY) {           

percent = .1 * (diffY - lastScrollY);   

if(percent > 0) percent = Math.ceil(percent);

else percent = Math.floor(percent); 

if(IE) document.all.floater.style.pixelTop += percent; 

if(NS) document.floater.top += percent;                

lastScrollY = lastScrollY + percent;      

}                      

if(diffX != lastScrollX) {      

percent = .1 * (diffX - lastScrollX);    

if(percent > 0) percent = Math.ceil(percent);      

else percent = Math.floor(percent);                  

if(IE) document.all.floater.style.pixelLeft += percent;       

if(NS) document.floater.left += percent;      

lastScrollX = lastScrollX + percent;                    

}                              

}                        

<!-- /STALKER CODE -->             

<!-- DRAG DROP CODE -->             

function checkFocus(x,y) {        

stalkerx = document.floater.pageX;    

stalkery = document.floater.pageY;                       

stalkerwidth = document.floater.clip.width;             

stalkerheight = document.floater.clip.height;                         

if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;                     

else return false;       

}                    

function grabIt(e) {           

if(IE) {                            

whichIt = event.srcElement;

while (whichIt.id.indexOf("floater") == -1) {   

whichIt = whichIt.parentElement;                          

if (whichIt == null) { return true; }        

 }                           

whichIt.style.pixelLeft = whichIt.offsetLeft;                             

whichIt.style.pixelTop = whichIt.offsetTop;                         

currentX = (event.clientX + document.body.scrollLeft);                      

currentY = (event.clientY + document.body.scrollTop);                            

} else {                            

window.captureEvents(Event.MOUSEMOVE);   

if(checkFocus (e.pageX,e.pageY)) {                           

whichIt = document.floater;                             

stalkerTouchedX = e.pageX-document.floater.pageX;     

StalkerTouchedY = e.pageY-document.floater.pageY;         

}                             

}                           

return true;                       

}                           

function moveIt(e) {              

if (whichIt == null) { return false; }      

if(IE) {                            

newX = (event.clientX + document.body.scrollLeft);                          

newY = (event.clientY + document.body.scrollTop);               

distanceX = (newX - currentX);    distanceY = (newY - currentY);  

currentX = newX;    currentY = newY;                      

whichIt.style.pixelLeft += distanceX;                         

whichIt.style.pixelTop += distanceY;                     

if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;    if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft; if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;

if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5; 

event.returnValue = false; 

} else {  

whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);

if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;

if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset; 

if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;

if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;

return false;}

return false; 

}  

function dropIt() {    

whichIt = null;    

if(NS) window.releaseEvents (Event.MOUSEMOVE); 

return true;            

       }                    

<!-- DRAG DROP CODE --> 

if(NS) {   

window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);

window.onmousedown = grabIt;

window.onmousemove = moveIt;

window.onmouseup = dropIt;

}             

if(IE) {                    

document.onmousedown = grabIt;   

document.onmousemove = moveIt;  

document.onmouseup = dropIt;         

       }                        

if(NS || IE) action = window.setInterval("heartBeat()",1);  

</SCRIPT>

 

0 Comments

Tue

03

Mar

2009

98、定在页面某个方位的宣传层

98、定在页面某个方位的宣传层

脚本说明:

把如下代码加入区域中

<STYLE type=text/css>

#floater {

       LEFT: 400px; POSITION: absolute; TOP: 120px; VISIBILITY: visible; WIDTH: 160px; Z-INDEX: 10

}

</STYLE>

<DIV align=center id=floater style="HEIGHT: 98px; WIDTH: 240px;">

<TABLE bgColor=#deefef border=1 borderColor=#008000 borderColorDark=#00ff00

borderColorLight=#ff00ff cellPadding=2 cellSpacing=1 width="240">

  <TBODY>

  <TR>

    <TD width="100%">

      <P align=center>欢迎大家光临“网页特效代码”<BR>JavaScript专栏!</P></TD></TR>

  <TR>

    <TD width="100%">   欢迎光临www.7stk.com,有什么意见和建议请尽管提出来,你的意见就是对我们的促进,我们会尽量为你们服务的.请多多支持我们的工作,成长中的每一步都会有你的足迹!!!<BR>   

      你若有什么好的建议和意见,可以给我<A

      href="mailto:x25455448545@163.com"><FONT color=#ff0000

      size=2>来信</FONT></A>,你若有好的例子,站长更希望能向你请教和学习。</TD></TR></TBODY></TABLE></DIV>

<SCRIPT language=JavaScript>                             

self.onError=null;                             

currentX = currentY = 0;                              

whichIt = null;                                        

lastScrollX = 0; lastScrollY = 0;                             

NS = (document.layers) ? 1 : 0;                            

IE = (document.all) ? 1: 0;                             

<!-- STALKER CODE -->                             

function heartBeat() {                              

if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }                             if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }          

if(diffY != lastScrollY) {           

percent = .1 * (diffY - lastScrollY);   

if(percent > 0) percent = Math.ceil(percent);

else percent = Math.floor(percent); 

if(IE) document.all.floater.style.pixelTop += percent; 

if(NS) document.floater.top += percent;                

lastScrollY = lastScrollY + percent;      

}                      

if(diffX != lastScrollX) {      

percent = .1 * (diffX - lastScrollX);    

if(percent > 0) percent = Math.ceil(percent);      

else percent = Math.floor(percent);                  

if(IE) document.all.floater.style.pixelLeft += percent;       

if(NS) document.floater.left += percent;      

lastScrollX = lastScrollX + percent;                    

}                              

}                        

<!-- /STALKER CODE -->             

<!-- DRAG DROP CODE -->             

function checkFocus(x,y) {        

stalkerx = document.floater.pageX;    

stalkery = document.floater.pageY;                       

stalkerwidth = document.floater.clip.width;             

stalkerheight = document.floater.clip.height;                         

if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;                     

else return false;       

}                    

function grabIt(e) {           

if(IE) {                            

whichIt = event.srcElement;

while (whichIt.id.indexOf("floater") == -1) {   

whichIt = whichIt.parentElement;                          

if (whichIt == null) { return true; }        

 }                           

whichIt.style.pixelLeft = whichIt.offsetLeft;                             

whichIt.style.pixelTop = whichIt.offsetTop;                         

currentX = (event.clientX + document.body.scrollLeft);                      

currentY = (event.clientY + document.body.scrollTop);                            

} else {                            

window.captureEvents(Event.MOUSEMOVE);   

if(checkFocus (e.pageX,e.pageY)) {                           

whichIt = document.floater;                             

stalkerTouchedX = e.pageX-document.floater.pageX;     

StalkerTouchedY = e.pageY-document.floater.pageY;         

}                             

}                           

return true;                       

}                           

function moveIt(e) {              

if (whichIt == null) { return false; }      

if(IE) {                            

newX = (event.clientX + document.body.scrollLeft);                          

newY = (event.clientY + document.body.scrollTop);               

distanceX = (newX - currentX);    distanceY = (newY - currentY);  

currentX = newX;    currentY = newY;                      

whichIt.style.pixelLeft += distanceX;                         

whichIt.style.pixelTop += distanceY;                     

if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;    if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft; if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;

if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5; 

event.returnValue = false; 

} else {  

whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);

if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;

if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset; 

if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;

if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;

return false;}

return false; 

}  

function dropIt() {    

whichIt = null;    

if(NS) window.releaseEvents (Event.MOUSEMOVE); 

return true;            

       }                    

<!-- DRAG DROP CODE --> 

if(NS) {   

window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);

window.onmousedown = grabIt;

window.onmousemove = moveIt;

window.onmouseup = dropIt;

}             

if(IE) {                    

document.onmousedown = grabIt;   

document.onmousemove = moveIt;  

document.onmouseup = dropIt;         

       }                        

if(NS || IE) action = window.setInterval("heartBeat()",1);  

</SCRIPT>

 

0 Comments

Tue

03

Mar

2009

97、随意飘动的小星星

97、随意飘动的小星星

脚本说明:

把如下代码加入区域中

<SCRIPT language=JavaScript1.2>

<!--

 

//set Interval between each firework display,

var intervals=2000

var sparksOn     = true;

var speed        = 40;

var power        = 3;

 

//Dont change these values-------

var documentWidth=documentHeight=randomx=randomy=leftcorner=topcorner=0

var ns=(document.layers);

var ie=(document.all);

var sparksAflyin = false;

var allDivs      = new Array(10);

var totalSparks  = 0;

//-------------------------------

 

function initAll(){

       if(!ns && !ie){

       sparksOn = false;

       return;

       }

setInterval("firework()",intervals)

 

if (ns)

       document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);

       for(dNum=0; dNum<7; ++dNum){

              if(ie)

                     allDivs[dNum]=eval('document.all.sDiv'+dNum+'.style');

              else

                     allDivs[dNum]=eval('document.layers["sDiv'+dNum+'"]');

       }

}

 

function firework(){

//below code detects the browser dimenions

if (ie){

documentWidth=document.body.clientWidth

documentHeight=document.body.clientHeight

leftcorner=document.body.scrollLeft

topcorner=document.body.scrollTop

}

else if (ns){

documentWidth=window.innerWidth

documentHeight=window.innerHeight

leftcorner=pageXOffset

topcorner=pageYOffset

 

}

//below code randomly generates a set of coordinates that fall within the dimension

randomx=leftcorner+Math.floor(Math.random()*documentWidth)

randomy=topcorner+Math.floor(Math.random()*documentHeight)

 

 

       if(sparksOn){

              if(!sparksAflyin){

                     sparksAflyin=true;

                     totalSparks=0;

                     for(var spark=0;spark<=6;spark++){

                            dx=Math.round(Math.random()*50);

                            dy=Math.round(Math.random()*50);

                            moveTo(spark,randomx,randomy,dx,dy);

                     }

              }

       }

}

 

function moveTo(i,tempx,tempy,dx,dy){

       if(ie){

              if(tempy+80>(document.body.offsetHeight+document.body.scrollTop))

                     tempy=document.body.offsetHeight+document.body.scrollTop-80;

              if(tempx+80>(document.body.offsetWidth+document.body.scrollLeft))

                     tempx=document.body.offsetWidth+document.body.scrollLeft-80;

       }

       if(tempx>-50&&tempy>-50){

              tempx+=dx;tempy+=dy;

              allDivs[i].left=tempx;

              allDivs[i].top=tempy;

              dx-=power;dy-=power;

              setTimeout("moveTo("+i+","+tempx+","+tempy+","+dx+","+dy+")",speed)

       }

       else

              ++totalSparks

       if(totalSparks==7){

              sparksAflyin=false;

              totalSparks=0;

       }

}

window.onload=initAll

//End-->

</SCRIPT>

<STYLE>#sDiv0 {

       COLOR: aqua; FONT-FAMILY: arial black; FONT-SIZE: 15px; HEIGHT: 1px; POSITION: absolute; WIDTH: 1px

}

#sDiv1 {

       COLOR: red; FONT-FAMILY: arial black; FONT-SIZE: 15px; HEIGHT: 1px; POSITION: absolute; WIDTH: 1px

}

#sDiv2 {

       COLOR: blue; FONT-FAMILY: arial black; FONT-SIZE: 15px; HEIGHT: 1px; POSITION: absolute; WIDTH: 1px

}

#sDiv3 {

       COLOR: orange; FONT-FAMILY: arial black; FONT-SIZE: 15px; HEIGHT: 1px; POSITION: absolute; WIDTH: 1px

}

#sDiv4 {

       COLOR: yellow; FONT-FAMILY: arial black; FONT-SIZE: 15px; HEIGHT: 1px; POSITION: absolute; WIDTH: 1px

}

#sDiv5 {

       COLOR: lightgreen; FONT-FAMILY: arial black; FONT-SIZE: 15px; HEIGHT: 1px; POSITION: absolute; WIDTH: 1px

}

#sDiv6 {

       COLOR: silver; FONT-FAMILY: arial black; FONT-SIZE: 15px; HEIGHT: 1px; POSITION: absolute; WIDTH: 1px

}

</STYLE>

<DIV id=sDiv0>*</DIV>

<DIV id=sDiv1>*</DIV>

<DIV id=sDiv2>*</DIV>

<DIV id=sDiv3>*</DIV>

<DIV id=sDiv4>*</DIV>

<DIV id=sDiv5>*</DIV>

<DIV id=sDiv6>*</DIV>

 

0 Comments

Tue

03

Mar

2009

96、进入页面异常酷的效果

96、进入页面异常酷的效果

<STYLE>DIV {

       POSITION: absolute

}

DIV.clButton {

       HEIGHT: 20px; TOP: -200px; WIDTH: 20px

}

#divStat {

       HEIGHT: 20px; LEFT: 8px; TOP: 12px; WIDTH: 130px

}

#divStatCont {

       HEIGHT: 45px; TOP: -200px; WIDTH: 125px

}

SPAN.clStat {

       COLOR: #606fa2; FONT-FAMILY: arial,helvetica; FONT-SIZE: 10px

}

#divDHTML {

       TOP: 20px; WIDTH: 100px

}

DIV.clLink {

       FONT-FAMILY: arial,helvetica; FONT-SIZE: 12px; FONT-WEIGHT: bold; VISIBILITY: hidden

}

#divExplain {

       FONT-FAMILY: arial,helvetica; FONT-SIZE: 12px

}

</STYLE>

 

<SCRIPT language=JavaScript>

 

function checkBrowser(){

       this.ver=navigator.appVersion

       this.dom=document.getElementById?1:0

       this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;

       this.ie4=(document.all && !this.dom)?1:0;

       this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;

       this.ns4=(document.layers && !this.dom)?1:0;

       this.ie=this.ie4||this.ie5

       this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)

       return this

}

bw=new checkBrowser()

 

//Preload

function preLoad(){

       for(i=0;i<arguments.length;i++){

              this[i]=new Image()

              this[i].src=arguments[i] 

       }

       return this

}

 

//Place your images in here

imgButLetter=new preLoad("letter_1.gif","letter_2.gif","letter_3.gif","letter_4.gif","letter_5.gif")

imgButCircle=new preLoad("button_4.gif","button_4.gif","button_4.gif","button_4.gif","button_4.gif")

 

//How many "balls" do you have

numBalls=5

 

function makePageCoords(){

       this.x=0;this.x2=(bw.ns4 || bw.ns5)?innerWidth:document.body.offsetWidth-20;

       this.y=0;this.y2=(bw.ns4 || bw.ns5)?innerHeight:document.body.offsetHeight-5;

       this.x50=this.x2/2;  this.y50=this.y2/2;

       return this;

}

function makeObj(obj,nest){

       nest=(!nest) ? '':'document.'+nest+'.'                                                                     

       this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;

      this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;             

       this.ref=bw.ns4?this.css.document:document;

       this.width=bw.ns4?this.css.document.width:this.el.offsetWidth

       this.moveBy=b_moveBy; this.moveIt=b_moveIt; this.writeIt=b_writeIt;

       this.slide=b_slide; this.slideIt=b_slideIt;

       this.showIt=b_showIt; this.hideIt=b_hideIt;

       this.obj = obj + "Object";     eval(this.obj + "=this")

}

function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}

function b_moveBy(x,y){this.x+=x; this.y+=y; this.css.left=this.x; this.css.top=this.y}

function b_showIt(){this.css.visibility="visible"}

function b_hideIt(){this.css.visibility="hidden"}

function b_writeIt(text){

       if(bw.ns4){this.ref.write(text);this.ref.close()}

       else this.el.innerHTML=text

}

function s_writeIt(text){

       text='<span class="clStat">'+text+'</span>'

       this.write(text)

}

function b_slideIt(endx,endy,inc,speed,fn,wh) {

if (!this.slideactive) {var distx = endx - this.x;var disty = endy - this.y

var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc

var dx = distx/num;var dy = disty/num

this.slideactive = 1; this.slide(dx,dy,endx,endy,speed,fn,wh)}}

function b_slide(dx,dy,endx,endy,speed,fn,wh) {

if (!fn) fn = null; if(!wh) wh=null

if (this.slideactive && (Math.floor(Math.abs(dx))<Math.floor(Math.abs(endx-this.x)) || Math.floor(Math.abs(dy))<Math.floor(Math.abs(endy-this.y)))) {

this.moveIt(this.x+dx,this.y+dy); eval(wh)

slidTim=setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+speed+",'"+fn+"','"+wh+"')",speed)

}else{this.slideactive = 0;this.moveIt(endx,endy);eval(fn)}}

 

function ballInit(){

       page=new makePageCoords()

       //Set the stop placements of each ball:

       ballXstop=new Array(page.x50-70,page.x50-40,page.x50-10,page.x50+20,page.x50+50)

       ballYstop=new Array(page.y50-12,page.y50-12,page.y50-12,page.y50-12,page.y50-12)

       //Set the angles of each ball

       angles=new Array(-180,-90,0,90,180)

      

       oBut=new Array()

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

              oBut[i]=new makeObj('divBut'+i)

              oBut[i].text=new makeObj('divLink'+i)

              oBut[i].moveIt(i*100,-50)

       }

       oStat=new makeObj('divStat','divStatCont')

       oStat.write=b_writeIt;

       oStat.writeIt=s_writeIt;

       oStatCont=new makeObj('divStatCont')

       oStatCont.moveIt(page.x2-135,page.y2-50)

       oDHTML=new makeObj('divDHTML')

       oDHTML.moveIt(page.x50-72,page.y50-13)

       doBall()

}

/************************************************************************************************

Ballpart start

***********************************************************************************************/

var ballBottom

var ballTop=0

var ballSpeed=25

var ballRight

var ballLeft=0

var xsling=60

var ysling=20

var got=0

ballGoing=true;

 

function fall(count){

       var fover=false

       for(var i=0;i<oBut.length;i++){

              if(oBut[i].ball.ready){

                     num=Math.round(Math.random()*4)

                     oBut[i].ref["imgBut"+i].src=imgButLetter[num].src

                     if(count==400 || count==550 || count==700){

                            oBut[i].ball.moveXpx-=2

                            oBut[i].ball.moveYpx+=2

                     }

                     fover=true

                     if(oBut[i].y<ballBottom && !oBut[i].ball.way){

                            if(oBut[i].x>ballRight-16 && oBut[i].x<ballRight) oBut[i].ball.xmove=-oBut[i].ball.moveXpx

                            else if(oBut[i].x>ballLeft-8 && oBut[i].x<ballLeft+8) oBut[i].ball.xmove=oBut[i].ball.moveXpx

                            oBut[i].moveBy(oBut[i].ball.xmove,oBut[i].ball.moveYpx)

                            oBut[i].ball.way=0

                     }else{

                            oBut[i].ball.way=1

                     }

                     if(oBut[i].y>ballTop && oBut[i].ball.way){

                            if(oBut[i].x>ballRight-16 && oBut[i].x<ballRight) oBut[i].ball.xmove=-oBut[i].ball.moveXpx

                            else if(oBut[i].x>ballLeft-8 && oBut[i].x<ballLeft+8) oBut[i].ball.xmove=oBut[i].ball.moveXpx

                            oBut[i].moveBy(oBut[i].ball.xmove,-oBut[i].ball.moveYpx)

                            oBut[i].ball.way=1

                     }else{

                            oBut[i].ball.way=0

                     }

                     if((oBut[i].x>oBut[i].ball.xpos-xsling && oBut[i].x<oBut[i].ball.xpos+xsling) && (oBut[i].y>oBut[i].ball.ypos-ysling && oBut[i].y<oBut[i].ball.ypos+ysling)){

                            oBut[i].ball.ready=false

                            oBut[i].ref["imgBut"+i].src=imgButLetter[i].src

                            oBut[i].slideIt(oBut[i].ball.xpos,oBut[i].ball.ypos,3,10)

                            got++

                            if(got!=oBut.length) oStat.writeIt('www.jzzy.com.<br>'+got +' placed, '+ (oBut.length-got) +' to go')

                            else{

                                   afterBall()

                            }

                     }

              }

       }

       count++

       if(fover)setTimeout("fall("+count+")",ballSpeed)

}

function makeBall(xspeed,yspeed,xpos,ypos){

       this.xpos=xpos

       this.ypos=ypos

       this.way=0

       this.ready=true

       this.moveXpx=xspeed

       this.moveYpx=yspeed

       num=Math.round(Math.random())

       if(num)   this.xmove=4

       else this.xmove=-4

       return this

}

function doBall(){

       oStat.writeIt('JavaScript')

       ballBottom=(bw.ie)?page.y2-27:page.y2-10;

       ballRight=(bw.ie)?page.x2-27:page.x2-5;

       for(i=0;i<oBut.length;i++){

              num=Math.round(Math.random()*3)

              oBut[i].ball=new makeBall(16-num-1,16-num,ballXstop[i],ballYstop[i])

       }

       fall(0)

}

 

function afterBall(){

       oStat.writeIt('JavaScript')

       ballGoing=false

       setTimeout("oDHTML.hideIt(); oStat.writeIt('welcome'); stopLetter("+oBut.length+")",300)

}

function stopLetter(num){

       if(num>0){

              num--

              oBut[num].ref["imgBut"+num].src=imgButCircle[num].src

              setTimeout("stopLetter("+num+")",100)

       }else{

              oStat.writeIt('网页特效代码')

              slideCircles(0)

       }

}

function slideCircles(num){

       if(num<30){

              for(i=0;i<oBut.length;i++){oBut[i].moveBy(-4+(i*2),0)}

              num++; setTimeout("slideCircles("+num+")",40)

       }else{

              oStat.writeIt('7stk.com.')

              c_left=oBut[2].x; c_top=oBut[2].y; circleCircles(0,0)

       }

}

var c_left,c_top; var angle=0;

function circleCircles(num,speed){

       if(num<361){

              for(i=0;i<oBut.length;i++){oBut[i].moveIt(Math.round(c_left + angles[i]*Math.cos(angle*Math.PI/180)),Math.round(c_top + angles[i]*Math.sin(angle*Math.PI/180)))}

              angle+=speed;

              if(num<180)   speed=speed+0.2; else speed=speed-0.2

              num++;setTimeout("circleCircles("+num+","+speed+")",15)

       }else{

              end(0)

       }

}

function end(num){

       if(num<oBut.length){

              oBut[num].text.moveIt((oBut[num].x+17)-(oBut[num].text.width/2),oBut[num].y+30)

              oBut[num].text.showIt()

              num++

              setTimeout("end("+num+")",100)

       }else{

              oStat.writeIt('JavaScript')

       }

}

onload=ballInit;

 

</SCRIPT>

 

<DIV id=divExplain></DIV>

<DIV id=divStatCont>

<DIV id=divStat></DIV></DIV>

<DIV id=divDHTML><IMG alt="" border=0 height=32 src="dhtml.gif"

width=144> </DIV>

<DIV class=clButton id=divBut0><A

href="http://www.7stk.com"><IMG alt=""

border=0 height=25 name=imgBut0 src="letter_1.gif" width=25></A> </DIV>

<DIV class=clButton id=divBut1><A

href="http://www.7stk.com"><IMG alt=""

border=0 height=25 name=imgBut1 src="letter_2.gif" width=25></A> </DIV>

<DIV class=clButton id=divBut2><A

href="http://www.7stk.com"><IMG alt=""

border=0 height=25 name=imgBut2 src="letter_3.gif" width=25></A> </DIV>

<DIV class=clButton id=divBut3><A

href="http://www.7stk.com"><IMG alt=""

border=0 height=25 name=imgBut3 src="letter_4.gif" width=25></A> </DIV>

<DIV class=clButton id=divBut4><A

href="http://www.7stk.com"><IMG alt=""

border=0 height=25 name=imgBut4 src="letter_5.gif" width=25></A> </DIV>

<DIV class=clLink id=divLink0>Link 1 </DIV>

<DIV class=clLink id=divLink1>Link 2 </DIV>

<DIV class=clLink id=divLink2>Link 3 </DIV>

<DIV class=clLink id=divLink3>Link 4 </DIV>

<DIV class=clLink id=divLink4>Link 5 </DIV>

 

 

1 Comments

Tue

03

Mar

2009

95、页面闪电效果

95、页面闪电效果

脚本说明:

把如下代码加入<body>区域中

<SCRIPT>

<!--

 

ie4=document.all?1:0;

ns4=document.layers?1:0;

ns5=(document.getElementById && !document.all)?1:0;

 

function init(){

// Bolt has an aura? (true | false) // takes twice as long to strike

aura=false;

bcolor="white";

acolor="blue";

 

// Make background color flash? (true | false)

flash=true;

skyNorm="black";

skyFlash="#000050";

if (flash) document.bgColor=skyNorm;

 

// nbs = Number of main bolt segments

nbs = 50;

ct=0;

// Font sizes for lightning bolt and aura segments

fsb=shi*.3;

fsf=shi*.2;

fsbi=shi*.2;

fsfi=shi*.12;

fsbii=shi*.12;

fsfii=shi*.07;

 

xpos=cswi; ypos=0;

if (ns5) ark = document.getElementById("ark");

if (ns4) {

 

ol=document.layers["ark"];

ol = new Layer(swi);

ol.left = 0;

ol.top = 0;

ol.height = shi;

ol.zIndex=1;

ol.visibility = "hide";

 

ret="<STYLE TYPE='text/css'>";

for (i=1;i<10;i++){

ret+="DIV.bolt"+i+" {position:absolute; font-style:'Times New Roman'; font-size:"+(fsf*i/9)+"px; color:"+bcolor+"; visibility:inherit; z-index:1}";

if (aura) ret+="DIV.bolta"+i+" {position:absolute; font-style:'Times New Roman'; font-size:"+(fsf*1.3*i/9)+"px; color:blue; visibility:inherit; z-index:0}";

} ret+="</STYLE>";

 

for (fs=1;fs<10;fs++)

for (i=1;i<nbs;i++) {

if (aura) ret+="<DIV id=a"+i+"f"+fs+" class=bolta"+fs+">.</DIV>";

ret+="<DIV id=s"+i+"f"+fs+" class=bolt"+fs+">.</DIV>";

}

 

//ol.document.open();

ol.document.write(ret);

ol.document.close();

}

Time1=setTimeout("mainplot()",100);

}

 

function mainplot()

{

lang=0;

xpos=Math.random()*cswi+cswi/2; ypos=0; fs=9; fsi=8

deg=Math.random()*30-15+((xpos<cswi)? +15:-15);

jag=Math.round(Math.random()*100)/100;

zag=Math.round(Math.random()*100)/100;

cur=Math.round((.5 * (Math.random()*10-5))*100)/100;

ion=(Math.random()>.5)? 1:-1;

//status=" "+ct+" Divs "+format(jag)+" jag "+format(zag)+" zag "+cur+" curve"; ct=0;

 

if (ns4)

{

for (i=1;i<nbs;i++) {

ang=Math.random()*jag*90-jag*45;

if (Math.random()+.05>zag) lang=Math.random()*zag*90-zag*45;

ang+=lang;

ct++;

if (Math.random()*10>9.5 && fsi>1) {fsi--; leg1();}

xpos+=Math.sin((deg+(ang+i*cur))/57.3)*(fsf*fs/9)*.07;

ypos+=Math.abs(Math.cos((deg+(ang+i*cur))/57.3)*(fsf*fs/9)*.07); //fsb=fsf*1.5;

if (aura) { ol.document.layers["a"+i+"f"+fs].moveTo(xpos-(fsf*1.3*fs/9)*.125,ypos-(fsf*1.3*fs/9)*.85); ct++;}

ol.document.layers["s"+i+"f"+fs].moveTo(xpos-(fsf*fs/9)*.125,ypos-(fsf*fs/9)*.85);

if (ypos>shi || xpos<0 || xpos>swi) i=nbs;

}

//status=" "+ct+" Divs "+format(jag)+" jag "+format(zag)+" zag "+cur+" curve";

ol.resizeTo(swi,shi);

Time1=setTimeout("light()",100);

}

 

if (ie4 || ns5) {

// Rewriting layers can be faster than repositioning in internet explorer

ret="";

fsf=shi*.2;

for (i=1;i<nbs;i++)

{

ang=Math.random()*jag*90-jag*45;

if (Math.random()+.05>zag) lang=Math.random()*zag*90-zag*45;

ang+=lang;

ct++;

if (Math.random()*10>9.5) {fsfi=fsf*.6; fsf*=.95; leg1();}

xpos+=Math.sin((deg+(ang+i*cur))/57.3)*fsf*.07;

ypos+=Math.abs(Math.cos((deg+(ang+i*cur))/57.3)*fsf*.07); fsb=fsf*1.3;

if (ypos>shi || xpos<0 || xpos>swi) i=nbs;

if (aura) { ret+="<DIV id='darg"+i+"' style='position:absolute; left:"+(xpos-fsb*.125)+"; top:"+(ypos-fsb*.85)+"; font-size:"+fsb+"px; color:rgb(0,0,255); z-Index:0' >.</DIV>"; ct++;}

ret+="<DIV style='position:absolute; left:"+(xpos-fsf*.125)+"; top:"+(ypos-fsf*.85)+"; font-size:"+fsf+"px; color:"+bcolor+"; z-Index:1' >.</DIV>";

}

//status=" "+ct+" Divs "+format(jag)+" jag "+format(zag)+" zag "+cur+" curve";

ark.innerHTML=ret;

Time1=setTimeout("lightie()",100);

}

}

 

function leg1() {

xpo=xpos; ypo=ypos;

lang=zag*ion*(30+Math.random()*20-10);

ion*=-1; lang1=0;

deg1=deg+ion*50+Math.random()*20-10;

jlen=Math.random()*nbs*.25+nbs*.25;

if(ns4) {

fsii=fsi-1

for (j=1;j<jlen;j++) {

ang1=Math.random()*jag*90-jag*45;

if (Math.random()+.05>zag) lang1=Math.random()*zag*90-zag*45;

ang1-=lang1;

ct++;

if (Math.random()*10>9.9 && fsii>1) {fsii--; leg2();}

xpo+=Math.sin((deg1+(ang1+j*cur))/57.3)*(fsf*fsi/9)*.07;

ypo+=Math.abs(Math.cos((deg1+(ang1+j*cur))/57.3)*(fsf*fsi/9)*.07);

if (aura) { ol.document.layers["a"+j+"f"+fsi].moveTo(xpo-(fsf*1.3*fsi/9)*.125,ypo-(fsf*1.3*fsi/9)*.85); ct++;}

ol.document.layers["s"+j+"f"+fsi].moveTo(xpo-(fsf*fsi/9)*.125,ypo-(fsf*fsi/9)*.85);

if (ypo>shi || xpo<0 || xpo>swi) j=jlen;

}

}

if (ie4 || ns5) {

ret+="<DIV id='fork'>";

for (j=1;j<jlen;j++)

{

ang1=Math.random()*jag*90-jag*45;

if (Math.random()+.05>zag) lang1=Math.random()*zag*90-zag*45;

ang1-=lang1;

ct++;

if (Math.random()*10>9.9) {fsfii=fsfi*.6; fsfi*=.95; leg2();}

xpo+=Math.sin((deg1+(ang1+j*cur))/57.3)*fsfi*.07;

ypo+=Math.cos((deg1+(ang1+j*cur))/57.3)*fsfi*.07; fsbi=fsfi*1.3;

if (ypo>shi || xpo<0 || xpo>swi) j=jlen;

if (aura) { ret+="<DIV id='arg"+j+"' style='position:absolute; left:"+(xpo-fsbi*.125)+"; top:"+(ypo-fsbi*.85)+"; font-size:"+fsbi+"px; color:rgb(0,0,255); z-Index:0' >.</DIV>"; ct++;}

ret+="<DIV style='position:absolute; left:"+(xpo-fsfi*.125)+"; top:"+(ypo-fsfi*.85)+"; font-size:"+fsfi+"px; color:"+bcolor+"; z-Index:1' >.</DIV>";

}ret+="</DIV>";

}

}

 

function leg2() {

xp=xpo; yp=ypo;

lang1=zag*ion*(30+Math.random()*20-10);

//ion*=-1;

lang2=0;

deg2=deg1+ion*50+Math.random()*20-10;

klen=Math.random()*nbs/2+nbs/2; // //

if (ns4) {

for (k=nbs/2;k<klen;k++) {

ang2=Math.random()*jag*90-jag*45;

if (Math.random()+.05>zag) lang2=Math.random()*zag*90-zag*45;

ang2-=lang2;

ct++;

xp+=Math.sin((deg2+(ang2+k*cur))/57.3)*(fsf*fsii/9)*.07;

yp+=Math.cos((deg2+ang2)/57.3)*(fsf*fsii/9)*.07;

if (aura) { ol.document.layers["a"+k+"f"+fsii].moveTo(xp-(fsf*1.3*fsii/9)*.125,yp-(fsf*1.3*fsii/9)*.85); ct++;}

ol.document.layers["s"+k+"f"+fsii].moveTo(xp-(fsf*fsii/9)*.125,yp-(fsf*fsii/9)*.85);

if (yp>shi || xp<0 || xp>swi) k=klen;

}

}

if (ie4 || ns5) {

ret+="<DIV id='forki'>";

for (k=nbs/2;k<klen;k++)

{

ang2=Math.random()*jag*90-jag*45;

if (Math.random()+.05>zag) lang2=Math.random()*zag*90-zag*45;

ang2-=lang2;

ct++;

xp+=Math.sin((deg2+(ang2+k*cur))/57.3)*fsfii*.07;

yp+=Math.cos((deg2+(ang2+k*cur))/57.3)*fsfii*.07; fsbii=fsfii*1.3;

if (yp>shi || xp<0 || xp>swi) k=klen;

if (aura) { ret+="<DIV id='arg"+k+"' style='position:absolute; left:"+(xp-fsbii*.125)+"; top:"+(yp-fsbii*.85)+"; font-size:"+fsbii+"px; color:rgb(0,0,255); z-Index:0' >.</DIV>"; ct++;}

ret+="<DIV style='position:absolute; left:"+(xp-fsfii*.125)+"; top:"+(yp-fsfii*.85)+"; font-size:"+fsfii+"px; color:"+bcolor+"; z-Index:1' >.</DIV>";

}

ret+="</DIV>";

}

}

 

function light()

{ ol.moveTo(pageXOffset,pageYOffset);

ol.visibility = "show";

if (flash) document.bgColor=skyFlash;

Time2=setTimeout("ning()",(Math.random()*1000+1000));

}

 

function lightie()

{ ark.style.left=document.body.scrollLeft;

ark.style.top=document.body.scrollTop;

ark.style.visibility = "visible";

if (flash) document.bgColor=skyFlash;

Time2=setTimeout("ningie()",(Math.random()*500+100));

}

 

function ning()

{

if (flash) document.bgColor=skyNorm;

ol.visibility = "hide";

if (Math.random()*3>2) Time2=setTimeout("light()",(Math.random()*500+100));

else {

for (fs=1;fs<10;fs++)

for (i=1;i<nbs;i++) {

if (aura) ol.document.layers["a"+i+"f"+fs].moveTo(-100,-100);

ol.document.layers["s"+i+"f"+fs].moveTo(-100,-100);

}

Time1=setTimeout("mainplot()",(Math.random()*500+100))

}

}

 

function ningie()

{ ark.style.visibility = "hidden";

if (flash) document.bgColor=skyNorm;

if (Math.random()*3>2) Time2=setTimeout("lightie()",(Math.random()*500+100)); else Time1=setTimeout("mainplot()",(Math.random()*500+100));

}

 

function format(f){ f+="";

if (f.charAt(0)==".") f="0"+f;

if (f.length==1) f+=".00";

if (f.length==3) f+="0";

return f;

}

 

function halt() {

if (Time1) {clearTimeout(Time1); Time1=null;}

if (Time2) {clearTimeout(Time2); Time2=null;}

}

 

//-->

 

</SCRIPT>

 

<SCRIPT language=Javascript>

<!--

swi=(ie4)? document.body.offsetWidth-17:window.innerWidth;

shi=(ie4)? document.body.offsetHeight-4:window.innerHeight;

cswi=swi/2;

cshi=shi/2;

 

ret="<DIV id='ark' style='position:absolute; left:0; top:0; width:"+swi+"; height:"+shi+"; visibility:visible; z-index=1; overflow:hidden; clip:rect(0,"+(swi)+","+(shi)+",0)'></DIV>";

document.write(ret);

 

//-->

</SCRIPT>

 

 

 

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

<BODY bgcolor="#fef4d9"

onload=window.focus();init();

onresize=document.location.href=document.location.href; onunload=halt();>

 

0 Comments

Tue

03

Mar

2009

94、极具创意的小球

94、极具创意的小球

脚本说明:

把如下代码加入<body>区域中

<STYLE type=text/css>DIV.clButtons {

       LEFT: 98px; VISIBILITY: inherit; WIDTH: 22px; POSITION: absolute; TOP: 6px; HEIGHT: 22px

}

#divCont {

       Z-INDEX: 30; VISIBILITY: hidden; WIDTH: 220px; CLIP: rect(0px 220px 220px 0px); POSITION: absolute; HEIGHT: 220px

}

#divCenter {

       LEFT: 10px; VISIBILITY: inherit; WIDTH: 200px; POSITION: absolute; TOP: 10px; HEIGHT: 200px

}

</STYLE>

 

<SCRIPT language=JavaScript type=text/javascript>

/**********************************************************************************  

CircleMenu

*   Copyright (C) 2001 Thomas Brattli

*   This script was released at DHTMLCentral.com

*   Visit for more great scripts!

*   This may be used and changed freely as long as this msg is intact!

*   We will also appreciate any links you could give us.

*

*   Made by Thomas Brattli

*********************************************************************************/

 

function lib_bwcheck(){ //Browsercheck (needed)

       this.ver=navigator.appVersion

       this.agent=navigator.userAgent

       this.dom=document.getElementById?1:0

       this.opera5=this.agent.indexOf("Opera 5")>-1

       this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;

       this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;

       this.ie4=(document.all && !this.dom && !this.opera5)?1:0;

       this.ie=this.ie4||this.ie5||this.ie6

       this.mac=this.agent.indexOf("Mac")>-1

       this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;

       this.ns4=(document.layers && !this.dom)?1:0;

       this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)

       return this

}

var bw=new lib_bwcheck()

 

 

/***************************************************************************

Object constructors; making Cross-browser object of the buttons

****************************************************************************/

//Debug function ******************

function lib_message(txt){alert(txt); return false}

 

//Lib objects  ********************

function lib_obj(obj,nest,o){

       if(!bw.bw) return lib_message('Old browser')

       nest=(!nest) ? "":'document.'+nest+'.'                                                                   

     if(o&&bw.ns4) this.evnt=o;

       else this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0;  

       if(!this.evnt) return lib_message('The layer does not exist ('+obj+') - \nIf your using Netscape please check the nesting of your tags!')

       this.css=bw.dom||bw.ie4?this.evnt.style:this.evnt; this.ref=bw.dom||bw.ie4?document:this.css.document;

       this.x=this.css.left||this.css.pixelLeft||this.evnt.offsetLeft||0; this.y=this.css.top||this.css.pixelTop||this.evnt.offsetTop||0

       this.w=this.evnt.offsetWidth||this.css.clip.width||this.ref.width||this.css.pixelWidth||0; this.h=this.evnt.offsetHeight||this.css.clip.height||this.ref.height||this.css.pixelHeight||0

       this.c=0 //Clip values

       if((bw.dom || bw.ie4) && this.css.clip) {

              this.c=this.css.clip; this.c=this.c.slice(5,this.c.length-1);

              this.c=this.c.split(' '); for(var i=0;i<4;i++){this.c[i]=parseInt(this.c[i])}

       }

       this.ct=this.css.clip.top||this.c[0]||0; this.cr=this.css.clip.right||this.c[1]||this.w||0

       this.cb=this.css.clip.bottom||this.c[2]||this.h||0; this.cl=this.css.clip.left||this.c[3]||0

       this.obj = obj + "Object";     eval(this.obj + "=this")

       return this

}

//Moving object to **************

lib_obj.prototype.moveIt = function(x,y){this.x=x;this.y=y; this.css.left=x;this.css.top=y}

 

//Showing object ************

lib_obj.prototype.showIt = function(){this.css.visibility="visible"}

 

//Document size object ********

function lib_doc_size(){

       this.x=0;this.x2=bw.ie && document.body.offsetWidth-20||innerWidth||0;

       this.y=0;this.y2=bw.ie && document.body.offsetHeight-5||innerHeight||0;

       if(!this.x2||!this.y2) return message('Document has no width or height')

       this.x50=this.x2/2;this.y50=this.y2/2;

       return this;

}

 

/***************************************************************************

Main variables

****************************************************************************/

//The radius for the circle

radius=92

//Start angle

startAngle=90

//Speed in milliseconds

circleSpeed=20

//angle to move per timeout

moveAngle=5

 

 

/***************************************************************************

Initiating the buttons and starts the circlemove

****************************************************************************/

var xcenter,ycenter,menuState,circleGoing;

function init(num){

       page=new lib_doc_size()

       //Making a simple object for the divCont

       oCont=new lib_obj('divCont')

       //Moving the divCont to the center of the page.

       oCont.moveIt(page.x2/2-110,page.y2/2-110)

       //Making an array to hold the button objects

       oBut=new Array()

       //Making button objects, arguments: divName,nested div,anglestop

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

              oBut[i]=new lib_obj('div'+i,'divCont')

       }

       //Setting stop angles for each button

       oBut[0].stop=0

       oBut[1].stop=30

       oBut[2].stop=-30

       oBut[3].stop=-90

       oBut[4].stop=-150

       oBut[5].stop=-210

       //Moves the button; ie5 bugfix

       oBut[0].moveIt(98,6)

       //Starts the circlemove

       xcenter = oBut[0].x - radius*Math.cos(startAngle*Math.PI/180)

       ycenter = oBut[0].y + radius*Math.sin(startAngle*Math.PI/180)

       oCont.showIt() //Showing cont layer

       circleGo(radius,-moveAngle,startAngle,oBut[5].stop,xcenter,ycenter,'menuState=1')

 

}

/***************************************************************************

Moves the buttons in a circle

****************************************************************************/

function circleGo(radius,angleinc,angle,endangle,xcenter,ycenter,fn,lnk) {

       //if angleinc < endangle-angle (no matter if it's positive or negative numbers)

       if ((Math.abs(angleinc)<Math.abs(endangle-angle))) {

              circleGoing=true

              angle += angleinc

              var x = xcenter + radius*Math.cos(angle*Math.PI/180)

              var y = ycenter - radius*Math.sin(angle*Math.PI/180)

              for(i=1;i<oBut.length;i++){

                     //if angle are bigger then the stop angle of each button

                     if(angle>=oBut[i].stop)  oBut[i].moveIt(x,y)

              }

              setTimeout("circleGo("+radius+","+angleinc+","+angle+","+endangle+","+xcenter+","+ycenter+",'"+fn+"','"+lnk+"')",circleSpeed)

       }else{

             circleGoing=false

              eval(fn)

       }

}

/***************************************************************************

When click on the buttons

****************************************************************************/

var zIndex=5

function mclick(num,lnk){

       //If it's not moving already

       if(!circleGoing){

              //Added feature; the clicked buttons stays on top!

              zIndex++

              oBut[num].css.zIndex=zIndex

              //Checks the state of the menu and circles it the right way

              if(menuState) circleGo(radius,moveAngle,oBut[5].stop,startAngle+5,xcenter,ycenter,'moveCenter("'+lnk+'")')

              else moveFromCenter(lnk)

       }

}    

//Moving the buttons to the center

function moveCenter(lnk){

       if(oBut[0].y<95){

              for(i=0;i<oBut.length;i++){

                     oBut[i].moveIt(oBut[i].x+(i-2.5),oBut[i].y+3)

              }

              setTimeout("moveCenter('"+lnk+"')",30)

       }else{    

              menuState=0

              if(lnk && String(lnk)!="undefined") location.href=lnk

              //HERE GOES CODE TO MAKE IT DO SOMETHING WHEN IT REACHES CENTER!

       }

}

//Moving the buttons from center

function moveFromCenter(lnk){

       if(oBut[0].y>6){

              for(i=0;i<oBut.length;i++){

                     oBut[i].moveIt(oBut[i].x-(i-2.5),oBut[i].y-3)

              }

              setTimeout("moveFromCenter('"+lnk+"')",30)

       }else{    

              circleGo(radius,-moveAngle,startAngle,oBut[5].stop,xcenter,ycenter,'menuState=1',lnk)

       }

}

/***************************************************************************

Mouseover and out on the buttons

****************************************************************************/

function mover(num){

       oBut[num].ref["img"+num].src='circlemenu1_1.gif'

}

function mout(num){

       oBut[num].ref["img"+num].src='circlemenu'+(num+1)+'.gif'

}

//Starting the menu on pageload.  

onload=init;   

</SCRIPT>

<DIV id=divCont><!-- Circle image -->

<DIV id=divCenter><IMG height=200 alt="" src="circlemenu.gif" width=200

border=0 name=imgCenter></DIV><!-- Buttons -->

<DIV class=clButtons id=div0><A onmouseover=mover(0)

onclick="mclick(0); parent.focus(); return false" onmouseout=mout(0)

href="#"><IMG height=22

alt="" src="circlemenu1.gif" width=22 border=0 name=img0></A></DIV>

<DIV class=clButtons id=div1><A onmouseover=mover(1)

onclick="mclick(1); parent.focus(); return false" onmouseout=mout(1)

href="#"><IMG height=22

alt="" src="circlemenu2.gif" width=22 border=0 name=img1></A></DIV>

<DIV class=clButtons id=div2><A onmouseover=mover(2)

onclick="mclick(2); parent.focus(); return false" onmouseout=mout(2)

href="#"><IMG height=22

alt="" src="circlemenu3.gif" width=22 border=0 name=img2></A></DIV>

<DIV class=clButtons id=div3><A onmouseover=mover(3)

onclick="mclick(3); parent.focus(); return false" onmouseout=mout(3)

href="#"><IMG height=22

alt="" src="circlemenu4.gif" width=22 border=0 name=img3></A></DIV>

<DIV class=clButtons id=div4><A onmouseover=mover(4)

onclick="mclick(4); parent.focus(); return false" onmouseout=mout(4)

href="#"><IMG height=22

alt="" src="circlemenu5.gif" width=22 border=0 name=img4></A></DIV><!-- Example with link -->

<DIV class=clButtons id=div5><A onmouseover=mover(5)

onclick="mclick(5,'http://www.1stscript.com'); parent.focus(); return false"

onmouseout=mout(5)

href="#"><IMG height=22

alt="" src="circlemenu6.gif" width=22 border=0

name=img5></A></DIV></DIV>

 

0 Comments

Tue

03

Mar

2009

93、蠕动的怪圈

93、蠕动的怪圈

脚本说明:

把如下代码加入<body>区域中

<script language=JavaScript>

 

if (document.all){

with (document){

write('<div id="starsDiv" style="position:absolute;top:0px;left:0px">')

str = '<div style="position:relative;width:XXpx;height:XXpx;background:#ffffff;font-size:XXpx;visibility:visible"></div>'

re = /XX/g;// 创建正则表达式模式?

str1=str.replace(re,"1")

str2=str.replace(re,"2")

str3=str.replace(re,"3")

for (j=0;j<2;j++)

{

       for (i=0;i<14;i++)

       write(str1)

 

       for (i=0;i<9;i++)

       write(str2)

}

write(str3)

write('</div>')

}

}

 

if (document.layers)

 

var yBase = 10;

var xBase = 10;

var step = 0.5;

var currStep = 0;

var Xpos = 520;

var Ypos = 250;

 

if (document.all)

{

  function MoveHandler(){

  Xpos = document.body.scrollLeft+event.x;

  Ypos = document.body.scrollTop+event.y;

  }

                ;

}

 

else if (document.layers)

{

  function xMoveHandler(evnt){

  Xpos = evnt.pageX;

  Ypos = evnt.pageY;

  }

  window.onMouseMove = xMoveHandler;

}

 

function animateLogo() {

if (document.all)

{

 yBase = window.document.body.offsetHeight/6;

 xBase = window.document.body.offsetWidth/6;

}

else if (document.layers)

{

 yBase = window.innerHeight/8;

 xBase = window.innerWidth/8;

}

 

if (document.all)

{

 for ( i = 0 ; i < starsDiv.all.length ; i++ )

 {

  starsDiv.all[i].style.top = Ypos + yBase*Math.sin((currStep + i*4)/12)*Math.cos(400+currStep/200);

 starsDiv.all[i].style.left = Xpos + xBase*Math.sin((currStep + i*3)/10)*Math.sin(currStep/200);

 }

}

 

else if (document.layers)

{

 for ( j = 0 ; j < 14 ; j++ ) //number of NS layers!

 {

  var templayer="a"+j

  document.layers[templayer].top = Ypos + yBase*Math.sin((currStep + j*4)/12)*Math.cos(400+currStep/200);

  document.layers[templayer].left = Xpos + xBase*Math.sin((currStep + j*3)/10)*Math.sin(currStep/200);

 }

}

currStep+= step;

setTimeout("animateLogo()", 10);

}

animateLogo();

</script>

 

0 Comments

Tue

03

Mar

2009

92、页面自动缩小

92、页面自动缩小

脚本说明:

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

<script  type="text/javascript">

function resizeWin(maxX,maxY,speed,delay,win){

       this.obj = "resizeWin" + (resizeWin.count++);

       eval(this.obj + "=this");

       if (!win)     this.win = self;    else this.win = eval(win);

       if (!maxX)    this.maxX = 400;    else this.maxX = maxX;

       if (!maxY)    this.maxY = 300;    else this.maxY = maxY;

       if (!speed)   this.speed = 1/7;   else this.speed = 1/speed;

       if (!delay)   this.delay = 30;    else this.delay = delay;

       this.doResize = (document.all || document.getElementById);

       this.stayCentered = false;

      

       this.initWin =        function(){

              if (this.doResize){

                     this.resizeMe();

                     }

              else {

                     this.win.resizeTo(this.maxX + 10, this.maxY - 20);

                     }

              }

 

       this.resizeMe = function(){

              this.win.focus();

              this.updateMe();

              }

      

       this.resizeTo = function(x,y){

              this.maxX = x;

              this.maxY = y;

              this.resizeMe();

              }

             

       this.stayCentered = function(){

              this.stayCentered = true;

              }

 

       this.updateMe = function(){

              this.resizing = true;

              var x = Math.ceil((this.maxX - this.getX()) * this.speed);

              var y = Math.ceil((this.maxY - this.getY()) * this.speed);

              if (x == 0 && this.getX() != this.maxX) {

                     if (this.getX() > this.maxX) x = -1;

                     else  x = 1;

                     }

              if (y == 0 && this.getY() != this.maxY){

                     if (this.getY() > this.maxY) y = -1;

                     else y = 1;

                     }

              if (x == 0 && y == 0) {

                     this.resizing = false;

                  }

              else {

                     this.win.top.resizeBy(parseInt(x),parseInt(y));

                     if (this.stayCentered == true) this.win.moveTo((screen.width - this.getX()) / 2,(screen.height - this.getY()) / 2);

                     setTimeout(this.obj + '.updateMe()',this.delay)

                     }

              }

             

       this.write =  function(text){

              if (document.all && this.win.document.all["coords"]) this.win.document.all["coords"].innerHTML = text;

              else if (document.getElementById && this.win.document.getElementById("coords")) this.win.document.getElementById("coords").innerHTML = text;

              }

             

       this.getX =  function(){

              if (document.all) return (this.win.top.document.body.clientWidth + 10)

              else if (document.getElementById)

                     return this.win.top.outerWidth;

              else return this.win.top.outerWidth - 12;

       }

      

       this.getY = function(){

              if (document.all) return (this.win.top.document.body.clientHeight + 29)

              else if (document.getElementById)

                     return this.win.top.outerHeight;

              else return this.win.top.outerHeight - 31;

       }

      

       this.onResize =  function(){

              if (this.doResize){

                     if (!this.resizing) this.resizeMe();

                     }

              }

 

       return this;

}

resizeWin.count = 0;

 

</script>

<script type="text/javascript">

<!--

booyah = new resizeWin(400,300); //(width, height)

booyah.stayCentered();

//-->

</script>

 

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

<body onLoad="booyah.initWin()" onResize="booyah.onResize()">

0 Comments

Tue

03

Mar

2009

91、页面 精彩的变色文字

91、页面 精彩的变色文字

脚本说明:

把如下代码加入<body>区域中

   <script language="JavaScript">

 

 

 /* This script was made by Erik.  You can contact him me worfy@geocities.com or at my homepage www.geocities.com/Area51/Corridor/4090. I know that it doesn't look pretty in the source code, but that couldn't be helped.  Feel free to modify this script in any way but please give me credit.  This is my first real script. 

 BTW  for you yankees, I spell colour with the U because I'm Canadain.*/

 

 

 hexa = new MakeArray(16)

 hexa[10] = "A"

 hexa[11] = "B"

 hexa[12] = "C"

 hexa[13] = "D"

 hexa[14] = "E"

 hexa[15] = "F"

 

 function MakeArray(n)

 {

 this.length = n

 for (var i = 0; i <= n; i++)

 this[i] = i

 return this

 }

 

 function colours(text){

 

 var posa = 0

 var posb = 1

 while (posa <= text.length){

 var r = Math.floor(Math.random() * 15)

 var rr= Math.floor(Math.random() * 15)

 var g = Math.floor(Math.random() * 15)

 var gg = Math.floor(Math.random() * 15)

 var b = Math.floor(Math.random() * 15)

 var bb = Math.floor(Math.random() * 15)

 if (text.substring(posa,posb) == "<"){

 var posaa = 0

 posaa = posa

 while (text.substring(posaa,posb) != ">"){

 posaa++

 posb++

 }

 document.write(text.substring(posa, posb))

 posa = posb

 posb = posa + 1

 }

 document.write("<font color=#"+hexa[r]+hexa[rr]+hexa[g]+hexa[gg]+hexa[b]+hexa[bb]+">")

 document.write(text.substring(posa, posb)+"</font>")

 posa++

 posb++

 }

 }

 

 </script>

 

   <script language = "javascript">

 

 text = "This JavaScript shows every other letter of text as a different, random colour."

 text +="You can also use any <blink> <font size=9> HTML </font> </blink> codes that you want"

 text +=" As long as you don't use quotation marks and the commands have a space between them."

 text +="  You can use any background colour or picture that you want, but black or white is sugeste"

 text +="d <b> <u>HAVE FUN!!! </u> </b>"

 

 colours(text)

 

 </script>

 

0 Comments