b-click

画面上に花びらを降らす

サンプル
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
var no = 10;
var do_laye = (document.layers) ? 1 : 0;
var do_all = (document.all) ? 1 : 0;
var dx, xp, yp;
var am, stx, sty;
var i, doc_width = 800, doc_height = 600;

if (do_laye) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (do_all) {
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();

for (i = 0; i < no; ++ i) {
dx[i] = 0;
xp[i] = Math.random()*(doc_width-50);
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
if (do_laye) {
if (i == 0) {
document.write("<layer name=\"down"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\"art/hanabira4.gif\" border=\"0\"></layer>");
} else {
document.write("<layer name=\"down"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\"art/hanabira1.gif\" border=\"0\"></layer>");
}
} else if (do_all) {
if (i == 0) {
document.write("<div id=\"down"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src=\"art/hanabira2.gif\" border=\"0\"></div>");
} else {
document.write("<div id=\"down"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src=\"art/hanabira3.gif\" border=\"0\"></div>");
}
}
}

function sakura_n() {
for (i = 0; i < no; ++ i) {
yp[i] += sty[i];
if (yp[i] > doc_height-50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 0;
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["down"+i].top = yp[i];
document.layers["down"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("sakura_n()", 10);
}

function sakura_ie() {
for (i = 0; i < no; ++ i) {
yp[i] += sty[i];
if (yp[i] > doc_height-50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
dx[i] += stx[i];
document.all["down"+i].style.pixelTop = yp[i];
document.all["down"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("sakura_ie()", 10);
}

if (do_laye) {
sakura_n();
} else if (do_all) {
sakura_ie();
}
//-->
</SCRIPT>

</BODY>
上のart/hanabira4.gifの部分(4カ所)を好きな絵にしてください。


コピーペーストしてこちらですぐにテストできます。


ソースを利用したら、http://www.act2cool.com/html/へリンクの協力を是非御願い致します。
バナーはこちらに
あります

クリックするだけで現金GET!総額100万円 
すほどお金になる!!ケータイポイント


Byホームページ改造王