qanglee 发表于 2007-4-27 11:49:08

***图形特效***雪景

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
--------------------------------------------------------------------------------

脚本说明:
把如下代码加入<body>区域中
<script language="javascript1.2">
<!-- begin
var no = 12; // number of hearts
var speed = 10; // smaller number moves the hearts faster
var heart = "5.gif";
var flag;
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;// amplitude and step variables
var i, doc_width = 800, 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;
}
dx = new array();
xp = new array();
yp = new array();
amx = new array();
amy = new array();
stx = new array();
sty = new array();
flag = new array();
for (i = 0; i < no; ++ i) {
dx = 0;                        // set coordinate variables
xp = math.random()*(doc_width-30)+10;// set position variables
yp = math.random()*doc_height;
amy = 12+ math.random()*20;         // set amplitude variables
amx = 10+ math.random()*40;
stx = 0.02 + math.random()/10; // set step variables
sty = 0.7 + math.random();   // set step variables
flag = (math.random()>0.5)?1:0;
if (ns4up) {                      // set layers
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
document.write("top=\"15\" visibility=\"show\"><img src=\"");
document.write(heart+ "\" border=\"0\">http://code.ik8.com/html/\</layer>");
} else {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
document.write("top=\"15\" visibility=\"show\"><img src=\"");
document.write(heart+ "\" border=\"0\">http://code.ik8.com/html/\</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;\"><img src=\"");
document.write(heart+ "\" border=\"0\">http://code.ik8.com/html/\</div>");
} else {
document.write("<div id=\"dot"+ i +"\" style=\"position: ");
document.write("absolute; z-index: "+ i +"; visibility: ");
document.write("visible; top: 15px; left: 15px;\"><img src=\"");
document.write(heart+ "\" border=\"0\">http://code.ik8.com/html/\</div>");
}
}
}

function snowns() {// netscape main animation function
for (i = 0; i < no; ++ i) {// iterate for every dot
if (yp > doc_height-50) {
xp = 10+ math.random()*(doc_width-amx-30);
yp = 0;
flag=(math.random()<0.5)?1:0;
stx = 0.02 + math.random()/10;
sty = 0.7 + math.random();
doc_width = self.innerwidth;
doc_height = self.innerheight;
}
if (flag)
dx += stx;
else
dx -= stx;
if (math.abs(dx) > math.pi) {
yp+=math.abs(amy*dx);
xp+=amx*dx;
dx=0;
flag=!flag;
}
document.layers["dot"+i].top = yp + amy*(math.abs(math.sin(dx)+dx));
document.layers["dot"+i].left = xp + amx*dx;

}
settimeout("snowns()", speed);
}

function snowie() {// ie main animation function
for (i = 0; i < no; ++ i) {// iterate for every dot
if (yp > doc_height-50) {
xp = 10+ math.random()*(doc_width-amx-30);
yp = 0;
stx = 0.02 + math.random()/10;
sty = 0.7 + math.random();
flag=(math.random()<0.5)?1:0;
doc_width = document.body.clientwidth;
doc_height = document.body.clientheight;
}
if (flag)
dx += stx;
else
dx -= stx;
if (math.abs(dx) > math.pi) {
yp+=math.abs(amy*dx);
xp+=amx*dx;
dx=0;
flag=!flag;
}

document.all["dot"+i].style.pixeltop = yp + amy*(math.abs(math.sin(dx)+dx));
document.all["dot"+i].style.pixelleft = xp + amx*dx;
}
settimeout("snowie()", speed);
}

if (ns4up) {
snowns();
} else if (ie4up) {
snowie();
}
// end -->
</script>



--------------------------------------------------------------------------------

      











--- -----------------------------------

拥有三人行论坛管理系列软件,一个人就可以管理一个 论坛的更 新维护。还能使您的论坛有千人在线的真实火 暴效果,让您不在为 论坛因没有人气而留不住会员而烦恼, 使您的论 坛早日 成为一流的论坛。详情请登陆网站:http://www.c nsrx.cn 三人行论坛管理软件,站长必备的专业好工具。(您使用的是免费版本,购买收费版本后,将不带广告。业务 QQ:2472164 4985227)
页: [1]
查看完整版本: ***图形特效***雪景