คำสั่งในช่อง scrollbar ข้างล่างนี้เป็น script ของรูป ส่วนใครที่ต้องการเปลี่ยนแปลง script ให้สังเกตที่ข้อความสีแดง คือ
pics=new Array "//i11.photobucket.com/albums/a171/merrymod/flower01.gif", "//i11.photobucket.com/albums/a171/merrymod/flower02.gif", "//i11.photobucket.com/albums/a171/merrymod/flower03.gif", "//i11.photobucket.com/albums/a171/merrymod/flower04.gif", "//i11.photobucket.com/albums/a171/merrymod/flower05.gif"); ใส่ค่า url ของรูปจำนวนเท่าที่ต้องการ
<script language="JavaScript"> <!-- Multi Random Movement 2 Script by kurt.grigg@virgin.net
Pic=new Array("//i11.photobucket.com/albums/a171/merrymod/ornament1.gif", "//i11.photobucket.com/albums/a171/merrymod/ornament2.gif", "//i11.photobucket.com/albums/a171/merrymod/ornament3.gif", "//i11.photobucket.com/albums/a171/merrymod/ornament4.gif", "//i11.photobucket.com/albums/a171/merrymod/ornament5.gif", "//i11.photobucket.com/albums/a171/merrymod/ornament6.gif", "//i11.photobucket.com/albums/a171/merrymod/ornament7.gif") MaxSpeed=4; MinSpeed=2;
/************************ Nothing needs altering below ************************/ load = new Array() for(i=0; i < Pic.length; i++) { load[i] = new Image(); load[i].src = Pic[i]; } n=Pic.length; n6=(document.getElementById&&!document.all); ns=(document.layers); ie=(document.all); d=(ns||ie)?'document.':'document.getElementById("'; a=(ns||n6)?'':'all.'; n6r=(n6)?'")':''; s=(ns)?'':'.style'; if (ns){ for (i=0; i < n; i++) document.write("<LAYER NAME='pics"+i+"' LEFT=0 TOP=0><img name='netpics' src="+load[i].src+"></LAYER>"); } if (ie||n6){ for (i=0; i < n; i++) document.write("<div id='pics"+i+"' style='position:absolute;top:0px;left:0px'><img src="+load[i].src+"></div>"); } VB=0; HB=0; R=new Array(); PB=new Array(); RD=new Array(); Y=new Array(); X=new Array(); D=new Array(); SP=new Array(); BY=new Array(); BX=new Array(); for (i=0; i < n; i++){ Y[i]=10; X[i]=10; D[i]=Math.floor(Math.random()*70+10); SP[i]=Math.floor(Math.random()*MaxSpeed+MinSpeed); } function Curve(){ plusMinus=new Array(1,-1,2,-2,3,-3,0,1,-1,0,5,-5) for (i=0; i < n; i++){ R[i]=Math.floor(Math.random()*plusMinus.length); RD[i]=plusMinus[R[i]]; } setTimeout('Curve()',1500); } function MoveRandom(){ var H=(ns||n6)?window.innerHeight:document.body.clientHeight; var W=(ns||n6)?window.innerWidth:document.body.clientWidth; var YS=(ns||n6)?window.pageYOffset:document.body.scrollTop; var XS=(ns||n6)?window.pageXOffset:document.body.scrollLeft; for (i=0; i < n; i++){ BY[i]=-load[i].height; BX[i]=-load[i].width; PB[i]=D[i]+=RD[i]; y = SP[i]*Math.sin(PB[i]*Math.PI/180); x = SP[i]*Math.cos(PB[i]*Math.PI/180); if (D[i] < 0) D[i]+=360; Y[i]+=y; X[i]+=x; VB=180-D[i]; HB=0-D[i]; //Corner rebounds! not necessary but looks nice. if ((Y[i] < 1) && (X[i] < 1)) {Y[i]=1;X[i]=1;D[i]=45;} if ((Y[i] < 1) && (X[i] > W+BX[i])) {Y[i]=1;X[i]=W+BX[i];D[i]=135;} if ((Y[i] > H+BY[i]) && (X[i] < 1)) {Y[i]=H+BY[i];X[i]=1;D[i]=315;} if ((Y[i] > H+BY[i]) && (X[i] > W+BX[i])) {Y[i]=H+BY[i];X[i]=W+BX[i];D[i]=225;} //Edge rebounds! if (Y[i] < 1) {Y[i]=1;D[i]=HB;} if (Y[i] > H+BY[i]) {Y[i]=H+BY[i];D[i]=HB;} if (X[i] < 1) {X[i]=1;D[i]=VB;} if (X[i] > W+BX[i]) {X[i]=W+BX[i];D[i]=VB;} var temp=eval(d+a+"pics"+i+n6r+s); temp.top=Y[i]+YS; temp.left=X[i]+XS; } setTimeout('MoveRandom()',70); } Curve(); MoveRandom(); //--> </script>
|