查看完整版本: 圖片紛飛

16-1-2010 11:04

圖片紛飛

<script language="JavaScript">
<!--wenchin
P=new Image();
Pic="http://www.bunbunhk.com/logo.ico"; //改為你要圖片,如改泡泡或雪花,效果甚佳
amount=10;  //圖片出現總數,可自行調節
BY=-15; //
BX=-15; //
S=5;

ns=(document.layers)?1:0;
if (ns){
for (i=0; i < amount; i++)
document.write("<LAYER NAME='netscape"+i+"' LEFT=0 TOP=0><img src="+Pic+"></LAYER>");
}
else{
document.write("<div style='position:absolute;top:0px;left:0px'><div style='position:relative'>");
for (i=0; i < amount; i++)
{document.write("<img id='explorer' src='"+Pic+"' style='position:absolute;top:0px;left:0px'>")}
document.write("</div></div>")
}
R=new Array(),PB=new Array(),RD=new Array(),Y=new Array(),X=new Array(),D=new Array(),VB=0,HB=0,SP=new Array();;
for (i=0; i < amount; i++){Y[i]=10;X[i]=10;D[i]=Math.floor(Math.random()*80+10);SP[i]=Math.floor(Math.random()*S+3)}
function Curve(){
plusMinus=new Array(1,-1,2,-2,3,-3,0,1,-1)
for (i=0; i < amount; i++){
R[i]=Math.floor(Math.random()*plusMinus.length);
RD[i]=plusMinus[R[i]];
}
setTimeout('Curve()',1800);
}
function MoveRandom(){
T=setTimeout('MoveRandom()',10);
var H=(document.layers)?window.innerHeight:document.body.clientHeight;
var W=(document.layers)?window.innerWidth:document.body.clientWidth;
var YS=(document.layers)?window.pageYOffset:document.body.scrollTop;
var XS=(document.layers)?window.pageXOffset:document.body.scrollLeft;
for (i=0; i < amount; i++){
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)) {Y[i]=1;X[i]=W+BX;D[i]=135;}
if ((Y[i] > H+BY) && (X[i] < 1)) {Y[i]=H+BY;X[i]=1;D[i]=315;}
if ((Y[i] > H+BY) && (X[i] > W+BX)) {Y[i]=H+BY;X[i]=W+BX;D[i]=225;}
//Edge rebounds!
if (Y[i] < 1) {Y[i]=1;D[i]=HB;}
if (Y[i] > H+BY) {Y[i]=H+BY;D[i]=HB;}
if (X[i] < 1) {X[i]=1;D[i]=VB;}
if (X[i] > W+BX) {X[i]=W+BX;D[i]=VB;}
var layer=(document.layers)?document.layers['netscape'+i]:explorer[i].style;
layer.top=Y[i]+YS;
layer.left=X[i]+XS;
}
}
function sTaRt(){Curve();MoveRandom()}
if (document.all||document.layers){sTaRt()}
//-->
</script>



<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<P>&lt;script language="JavaScript"&gt;<BR>&lt;!--wenchin <BR>P=new Image();<BR>Pic="<A href="http://www.bunbunhk.com/logo.ico">http://www.bunbunhk.com/logo.ico</A>"; //改為你要圖片,如改泡泡或雪花,效果甚佳<BR>amount=10;&nbsp; //圖片出現總數,可自行調節<BR>BY=-15; //<BR>BX=-15; //<BR>S=5; </P>
<P>ns=(document.layers)?1:0;<BR>if (ns){<BR>for (i=0; i &lt; amount; i++)<BR>document.write("&lt;LAYER NAME='netscape"+i+"' LEFT=0 TOP=0&gt;&lt;img src="+Pic+"&gt;&lt;/LAYER&gt;");<BR>}<BR>else{<BR>document.write("&lt;div style='position:absolute;top:0px;left:0px'&gt;&lt;div style='position:relative'&gt;");<BR>for (i=0; i &lt; amount; i++)<BR>{document.write("&lt;img id='explorer' src='"+Pic+"' style='position:absolute;top:0px;left:0px'&gt;")}<BR>document.write("&lt;/div&gt;&lt;/div&gt;")<BR>}<BR>R=new Array(),PB=new Array(),RD=new Array(),Y=new Array(),X=new Array(),D=new Array(),VB=0,HB=0,SP=new Array();;<BR>for (i=0; i &lt; amount; i++){Y[i]=10;X[i]=10;D[i]=Math.floor(Math.random()*80+10);SP[i]=Math.floor(Math.random()*S+3)}<BR>function Curve(){<BR>plusMinus=new Array(1,-1,2,-2,3,-3,0,1,-1)<BR>for (i=0; i &lt; amount; i++){<BR>R[i]=Math.floor(Math.random()*plusMinus.length);<BR>RD[i]=plusMinus[R[i]];<BR>}<BR>setTimeout('Curve()',1800);<BR>}<BR>function MoveRandom(){<BR>T=setTimeout('MoveRandom()',10);<BR>var H=(document.layers)?window.innerHeight:document.body.clientHeight;<BR>var W=(document.layers)?window.innerWidth:document.body.clientWidth;<BR>var YS=(document.layers)?window.pageYOffset:document.body.scrollTop;<BR>var XS=(document.layers)?window.pageXOffset:document.body.scrollLeft;<BR>for (i=0; i &lt; amount; i++){<BR>PB[i]=D[i]+=RD[i];<BR>y = SP[i]*Math.sin(PB[i]*Math.PI/180);<BR>x = SP[i]*Math.cos(PB[i]*Math.PI/180);<BR>if (D[i] &lt; 0) D[i]+=360;<BR>Y[i]+=y;<BR>X[i]+=x;<BR>VB=180-D[i];<BR>HB=0-D[i];<BR>//Corner rebounds! not necessary but looks nice.<BR>if ((Y[i] &lt; 1) && (X[i] &lt; 1)) {Y[i]=1;X[i]=1;D[i]=45;}<BR>if ((Y[i] &lt; 1) && (X[i] &gt; W+BX)) {Y[i]=1;X[i]=W+BX;D[i]=135;}<BR>if ((Y[i] &gt; H+BY) && (X[i] &lt; 1)) {Y[i]=H+BY;X[i]=1;D[i]=315;}<BR>if ((Y[i] &gt; H+BY) && (X[i] &gt; W+BX)) {Y[i]=H+BY;X[i]=W+BX;D[i]=225;}<BR>//Edge rebounds!<BR>if (Y[i] &lt; 1) {Y[i]=1;D[i]=HB;} <BR>if (Y[i] &gt; H+BY) {Y[i]=H+BY;D[i]=HB;} <BR>if (X[i] &lt; 1) {X[i]=1;D[i]=VB;} <BR>if (X[i] &gt; W+BX) {X[i]=W+BX;D[i]=VB;} <BR>var layer=(document.layers)?document.layers['netscape'+i]:explorer[i].style;<BR>layer.top=Y[i]+YS;<BR>layer.left=X[i]+XS;<BR>}<BR>}<BR>function sTaRt(){Curve();MoveRandom()}<BR>if (document.all||document.layers){sTaRt()}<BR>//--&gt;<BR>&lt;/script&gt; </P>

25-5-2013 12:01

複製上列語法

<form name="copy">
<textarea cols="40" name="txt" rows="4" style="BACKGROUND-COLOR:#ffffff; COLOR:#000000; FONT-SIZE:9pt">
<script language="JavaScript">
<!--wenchin
P=new Image();
Pic="http://www.bunbunhk.com/logo.ico"; //改為你要圖片,如改泡泡或雪花,效果甚佳
amount=10;  //圖片出現總數,可自行調節
BY=-15; //
BX=-15; //
S=5;

ns=(document.layers)?1:0;
if (ns){
for (i=0; i < amount; i++)
document.write("<LAYER NAME='netscape"+i+"' LEFT=0 TOP=0><img src="+Pic+"></LAYER>");
}
else{
document.write("<div style='position:absolute;top:0px;left:0px'><div style='position:relative'>");
for (i=0; i < amount; i++)
{document.write("<img id='explorer' src='"+Pic+"' style='position:absolute;top:0px;left:0px'>")}
document.write("</div></div>")
}
R=new Array(),PB=new Array(),RD=new Array(),Y=new Array(),X=new Array(),D=new Array(),VB=0,HB=0,SP=new Array();;
for (i=0; i < amount; i++){Y[i]=10;X[i]=10;D[i]=Math.floor(Math.random()*80+10);SP[i]=Math.floor(Math.random()*S+3)}
function Curve(){
plusMinus=new Array(1,-1,2,-2,3,-3,0,1,-1)
for (i=0; i < amount; i++){
R[i]=Math.floor(Math.random()*plusMinus.length);
RD[i]=plusMinus[R[i]];
}
setTimeout('Curve()',1800);
}
function MoveRandom(){
T=setTimeout('MoveRandom()',10);
var H=(document.layers)?window.innerHeight:document.body.clientHeight;
var W=(document.layers)?window.innerWidth:document.body.clientWidth;
var YS=(document.layers)?window.pageYOffset:document.body.scrollTop;
var XS=(document.layers)?window.pageXOffset:document.body.scrollLeft;
for (i=0; i < amount; i++){
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)) {Y[i]=1;X[i]=W+BX;D[i]=135;}
if ((Y[i] > H+BY) && (X[i] < 1)) {Y[i]=H+BY;X[i]=1;D[i]=315;}
if ((Y[i] > H+BY) && (X[i] > W+BX)) {Y[i]=H+BY;X[i]=W+BX;D[i]=225;}
//Edge rebounds!
if (Y[i] < 1) {Y[i]=1;D[i]=HB;}
if (Y[i] > H+BY) {Y[i]=H+BY;D[i]=HB;}
if (X[i] < 1) {X[i]=1;D[i]=VB;}
if (X[i] > W+BX) {X[i]=W+BX;D[i]=VB;}
var layer=(document.layers)?document.layers['netscape'+i]:explorer[i].style;
layer.top=Y[i]+YS;
layer.left=X[i]+XS;
}
}
function sTaRt(){Curve();MoveRandom()}
if (document.all||document.layers){sTaRt()}
//-->
</script>
</textarea><br>
<input onclick="javascript:this.form.txt.focus();this.form.txt.select();" type="button" value="全選">
</form>

<BR>

<script type="text/javascript"><!--
google_ad_client = "ca-pub-4078143172638881";
/* 336X280 */
google_ad_slot = "3268225205";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
頁: [1]
查看完整版本: 圖片紛飛