Make the home page appear "flying" effects

Source: Internet
Author: User
Friends, have you ever heard of "Falling in the sky"? Oh, the trap cake It is a mody, today teaches you a heaven to drop ¥ of the Recruit son, and ~ ~ Hua Hua to drop! Ha-ha-ha, come on ^_*

Add the following JavaScript code to the < head > area:

< Script language= "JavaScript" >
<!--Begin
var no = 30;
file://SetSet down the number of characters
var speed = 5;
file://SetThe speed of the falling of the fixed character
var ns4up = (document.layers)? 1:0;
var ie4up = (document.all)? 1:0;
File://NETSCAPand IE two different browsers to define each
var s, x, Y, SN, CS;
var A, R, CX, CY;
var i, doc_width = a, doc_height = 600;
file://SetStationary character drop area for 800*600
if (ns4up) {
Doc_width = Self.innerwidth;
Doc_height = Self.innerheight;
}
Else
if (ie4up) {
Doc_width = Document.body.clientWidth;
Doc_height = Document.body.clientHeight;
}
File://NETSCAPand IE two different browsers
x = new Array ();
y = new Array ();
R = new Array ();
CX = new Array ();
cy = new Array ();
s = 8;
for (i = 0; i < no; + i) {
Initrain ();
file://SetArray of literal variables x, y, CX, CY, s
if (ns4up) {
if (i = = 0) {
document.write ("< layer name=\" dot "+ i +" \ "left=\" 1\ ");
document.write ("top=\" 1\ "visibility=\" show\ ">< font color=\" white\ ">");
document.write (",¥</font ></layer >");
}
else {
document.write ("< layer name=\" dot "+ i +" \ "left=\" 1\ ");
document.write ("top=\" 1\ "visibility=\" show\ ">< font color=\" white\ ">");
document.write (", $ </font ></layer >");
}
}
file://whenI==0 satisfaction or not, the performance of Netscap
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;\ ">< font size=\" 10\ "color=\" white\ ">");
document.write ("¥</font ></div >");
}
else {
document.write ("< div id=\" dot "+ i +" \ "style=\" POSITION: ");
document.write ("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write ("visible; top:15px; Left:15px;\ ">< font size=\" 10\ "color=\" white\ ">");
document.write ("$ </font ></div >");file://SetThe character to be dropped (¥, $) and position
}
}
file://whenI==0 content and unsatisfied, the performance of IE browser
}
function Initrain () {
A = 6;
R[i] = 1;
sn = Math.sin (a);
CS = Math.Cos (a);
Cx[i] = math.random () * doc_width + 1;
Cy[i] = math.random () * doc_height + 1;
X[i] = r[i] * sn + cx[i];
Y[i] = Cy[i];
}
function Makerain () {
R[i] = 1;
Cx[i] = math.random () * doc_width + 1;
Cy[i] = 1;
X[i] = r[i] * sn + cx[i];
Y[i] = r[i] * cs + cy[i];
}
function Updaterain () {
R[i] + = s;
X[i] = r[i] * sn + cx[i];
Y[i] = r[i] * cs + cy[i];
}
function Raindropns () {
for (i = 0; i < no; + i) {
Updaterain ();
file://SetArray of literal variables A, SN, CS, CX, CY, s
if ((X[i] < = 1) | | (X[i] >= (doc_width-20)) | | (Y[i] >= (doc_height-20))) {
Makerain ();
Doc_width = Self.innerwidth;
Doc_height = Self.innerheight;
}
document.layers["dot" +i].top = y[i];
document.layers["dot" +i].left = x[i];
}
SetTimeout ("Raindropns ()", speed);
}
function Raindropie () {
for (i = 0; i < no; + i) {
Updaterain ();
file://inNetscap the value of the process in the browser
if ((X[i] < = 1) | | (X[i] >= (doc_width-20)) | | (Y[i] >= (doc_height-20))) {
Makerain ();
Doc_width = Document.body.clientWidth;
Doc_height = Document.body.clientHeight;
}
document.all["dot" +i].style.pixeltop = y[i];
document.all["dot" +i].style.pixelleft = x[i];
}
SetTimeout ("Raindropie ()", speed);
}
if (ns4up) {Raindropns ();}
Else
if (ie4up) {Raindropie ();}
file://inThe value-paying process in IE browser
End-->
</script >



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.