110、飘落的多图片
脚本说明:
第一步:把如下代码加入<body>区域中
<STYLE>
#Layer0 {
Z-INDEX: 10; LEFT: -100px; WIDTH: 60px; POSITION: absolute; TOP: -100px; HEIGHT: 60px
}
#Layer1 {
Z-INDEX: 20; LEFT: -100px; WIDTH: 60px; POSITION: absolute; TOP: -100px; HEIGHT: 60px
}
#Layer2 {
Z-INDEX: 30; LEFT: -100px; WIDTH: 60px; POSITION: absolute; TOP: -100px; HEIGHT: 60px
}
#Layer3 {
Z-INDEX: 40; LEFT: -100px; WIDTH: 60px; POSITION: absolute; TOP: -100px; HEIGHT: 60px
}
#Layer4 {
Z-INDEX: 50; LEFT: -100px; WIDTH: 60px; POSITION: absolute; TOP: -100px; HEIGHT: 60px
}
#Layer5 {
Z-INDEX: 60; LEFT: -100px; WIDTH: 60px; POSITION: absolute; TOP: -100px; HEIGHT: 60px
}
#Layer6 {
Z-INDEX: 70; LEFT: -100px; WIDTH: 60px; POSITION: absolute; TOP: -100px; HEIGHT: 60px
}
BODY {
FONT-SIZE: 9pt; WORD-SPACING: normal; LINE-HEIGHT: 13pt
}
P {
FONT-SIZE: 9pt; WORD-SPACING: normal; LINE-HEIGHT: 13pt
}
TD {
FONT-SIZE: 9pt; WORD-SPACING: normal; LINE-HEIGHT: 13pt
}
</STYLE>
<SCRIPT language=JavaScript>
xfirst = new Array(80,150,220,310,400,590,680); //初始x位置
yfirst = new Array(0,180,70,10,50,30,140); //初始y位置
xcoor = new Array(80,150,220,310,400,590,680);
ycoor = new Array(0,180,70,10,50,30,140);
xdirec= new Array(1,-1,1,-1,1,-1); //初始方向 -1 为左 and 1 为右
var ns = navigator.appName == "Netscape";
function doplay()
{
var x,y,i,j,w,h;
w = window.screen.width - 100;
// w = document.body.clientWidth - 100;
h = window.screen.height - 100;
// h = document.body.clientHeight - 50;
for(j=0;j<7;j++){
i=Math.random(); //随机改变运动方向
if (i > 0.95) xdirec[j] = 0 - xdirec[j];
x=Math.floor(10*Math.random());
y=Math.floor(5*Math.random()); //x和y方向上的随机增量
if ( xdirec[j] == 1 ) xcoor[j] = xcoor[j] + x;
else xcoor[j] = xcoor[j] - x;
ycoor[j] = ycoor[j] + y; //x越界则变向,y越界则返回
if ( xcoor[j] >= w ) {xcoor[j]=w;xdirec[j]=-1;}
if ( xcoor[j] <= 0 ) {xcoor[j]=0;xdirec[j]=1;}
if ( ycoor[j] >= h ) {xcoor[j]=xfirst[j];ycoor[j]=yfirst[j];}
if (!ns){ eval('document.all'+'["Layer'+j+'"]'+'.style.left='+xcoor[j]);
eval('document.all'+'["Layer'+j+'"]'+'.style.top='+ycoor[j]);}
else { eval('document.layers'+'["Layer'+j+'"]'+'.left='+xcoor[j]);
eval('document.layers'+'["Layer'+j+'"]'+'.top='+ycoor[j]);}
}
setTimeout('doplay()',100);
}
doplay()
</SCRIPT>
<DIV id=Layer0><IMG height=14 src="hua1.gif" width=14> </DIV>
<DIV id=Layer1><IMG height=25 src="hua.gif" width=25> </DIV>
<DIV id=Layer2><IMG height=25 src="hua.gif" width=25> </DIV>
<DIV id=Layer3><IMG height=14 src="hua2.gif" width=14> </DIV>
<DIV id=Layer4><IMG height=14 src="hua1.gif" width=14> </DIV>
<DIV id=Layer5><IMG height=14 src="hua2.gif" width=14> </DIV>
<DIV id=Layer6><IMG height=25 src="hua.gif" width=25> </DIV>
第二步:把<body>中的内容改为:
<body onload=doplay()>
Write a comment