Floating petals on Web pages
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> none </title>
<SCRIPT language = JavaScript>
<! -- Original: Altan (snow@altan.hr) -->
<! -- Web Site: http://www.altan.hr/snow -->
<! -- Smaller flakes, subtle snowfall variables, code beautifcation and makeSnow function by NoSLZZP -->
Var no = 6; // snow number
Var speed = 12; // smaller number moves the snow faster
Var snowflake = "/Jsupload/2006819224938886.GIF ";
Var ns4up = (document. layers )? 1: 0; // browser sniffer
Var ie4up = (document. all )? 1: 0;
Var dx, xp, yp; // coordinate and position variables
Var am, stx, sty; // Amplications and step variables
Var I, doc_width = 400, doc_height = 500;
If (ns4up ){
Doc_width = self. innerWidth;
Doc_height = self. innerHeight;
} Else if (ie4up ){
Doc_width = 500;
Doc_height = 500;
}
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
= 0; // set coordinate variables
Xp= Math. random () * (doc_width-50); // set position variables
Yp= Math. random () * doc_height;
Am= Math. random () * 20; // set amplitude variables
Stx= 0.02 + Math. random ()/10; // set step variables
Sty= 0.7 + Math. random (); // set step variables
If (ns4up) {// set layers
If (I = 0 ){
Document. write ("<layer name = \" dot "+ I +" \ "left = \" 15 \"");
Document. write ("top = \" 15 \ "visibility = \" show \ "> Document. write (snowflake + "\" border = \ "0 \"> </layer> ");
} Else {
Document. write ("<layer name = \" dot "+ I +" \ "left = \" 15 \"");
Document. write ("top = \" 15 \ "visibility = \" show \ "> Document. write (snowflake + "\" border = \ "0 \"> </layer> ");
}
} Else if (ie4up ){
If (I = 0 ){
Document. write ("<div id = \" dot "+ I +" \ "style = \" POSITION :");
Document. write ("absolute; Z-INDEX:" + I + "; VISIBILITY :");
Document. write ("visible; TOP: 15px; LEFT: 15px; \"> Document. write (snowflake + "\" border = \ "0 \"> </div> ");
} Else {
Document. write ("<div id = \" dot "+ I +" \ "style = \" POSITION :");
Document. write ("absolute; Z-INDEX:" + I + "; VISIBILITY :");
Document. write ("visible; TOP: 15px; LEFT: 15px; \"> Document. write (snowflake + "\" border = \ "0 \"> </div> ");
}
}
}
Function snowNS () {// Netscape main animation function
For (I = 0; I <no; ++ I) {// iterate for every dot
Yp+ = Sty;
If (yp> Doc_height-50 ){
Xp= Math. random () * (doc_width-am-30 );
Yp= 0;
Stx= 0.02 + Math. random ()/10;
Sty= 0.7 + Math. random ();
Doc_width = self. innerWidth;
Doc_height = self. innerHeight;
}
Dx+ = Stx;
Document. layers ["dot" + I]. top = yp;
Document. layers ["dot" + I]. left = xp+ Am* Math. sin (dx);
}
SetTimeout ("snowNS ()", speed );
}
Function snowIE () {// IE main animation function
For (I = 0; I <no; ++ I) {// iterate for every dot
Yp+ = Sty;
If (yp> Doc_height-50 ){
Xp= Math. random () * (doc_width-am-30 );
Yp= 0;
Stx= 0.02 + Math. random ()/10;
Sty= 0.7 + Math. random ();
Doc_width = document. body. clientWidth;
Doc_height = document. body. clientHeight;
}
Dx+ = Stx;
Document. all ["dot" + I]. style. pixelTop = yp;
Document. all ["dot" + I]. style. pixelLeft = xp+ Am* Math. sin (dx);
}
SetTimeout ("snowIE ()", speed );
}
If (ns4up ){
SnowNS ();
} Else if (ie4up ){
SnowIE ();
}
</SCRIPT>
</Head>
<Body>
</Body>
</Html>