JavaScript implements popup code in the lower right corner of the Web page

Source: Internet
Author: User

<script language= "JavaScript" >
<!--
var no = 50;
var speed = 1;
var ns4up = (document.layers)? 1:0;
var ie4up = (document.all)? 1:0;
var s, x, Y, SN, CS;
var A, R, CX, CY;
var i, doc_width = Doc_height = 600;
if (ns4up) {
Doc_width = Self.innerwidth;
Doc_height = Self.innerheight;
}
Else
if (ie4up) {
Doc_width = Document.body.clientWidth;
Doc_height = Document.body.clientHeight;
}
x = new Array ();
y = new Array ();
R = new Array ();
CX = new Array ();
cy = new Array ();
s = 8;
for (i = 0; i < no; + + i) {
Initrain ();
if (ns4up) {
if (i = = 0) {
document.write ("<layer name=\" dot "+ i +" \ "left=\" 1\ "");
document.write ("top=\" 1\ "visibility=\" show\ "><font color=\" red\ ">");
document.write (",</font></layer>");
}
else {
document.write ("<layer name=\" dot "+ i +" \ "left=\" 1\ "");
document.write ("top=\" 1\ "visibility=\" show\ "><font color=\" red\ ">");
document.write (",</font></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;\ "><font color=\" red\ ">");
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 color=\" red\ ">");
document.write (",</font></div>");
}
}
}
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 ();
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 ();
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 ();
}

-
</script>

JavaScript implements popup code in the lower right corner of the Web page

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.