Cheer 发表于 2007-4-28 11:01:58

图形特效掉落的图片

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
<!-- two steps to install ball drop:

1.复制本代码到你的html文档的head标记内
2.将最后一段代码放入html文档的body标记内-->

<!-- step one: 复制本代码到你的html文档的head标记内-->

<head>

<script language="javascript1.2">


<!-- begin
function browsercheck() {
var b = navigator.appname;
if (b == "netscape") this.b = "ns";
else if (b == "microsoft internet explorer") this.b = "ie";
else this.b = b;
this.v = parseint(navigator.appversion);
this.ns = (this.b == "ns" && this.v>=4);
this.ns4 = (this.b == "ns" && this.v == 4);
this.ns5 = (this.b == "ns" && this.v == 5);
this.ie = (this.b == "ie" && this.v>=4);
this.ie4 = (navigator.useragent.indexof('msie 4')>0);
this.ie5 = (navigator.useragent.indexof('msie 5')>0);
if (this.ie5 || this.ns5) this.ver5 = true;
if (this.ie4 || this.ns4) this.ver4 = true;
this.old = (! this.ver5 && ! this.ver4) ? true : false;
this.min = (this.ns||this.ie);
}
is = new browsercheck();
//end -->
</script>
</head>

<!-- step two: 将最后一段代码放入html文档的body标记内-->

<body>

<center>
click anywhere to start script<br>
<div id="staticball" style="position:relative;visibility:visible">
<img src="http://www.jojoo.net/logo.gif" height=30 width=30 alt="static ball">
http://www.jojoo.net/logo.gif</div>
</center>
<div id="ball" style="visibility:hidden; position:absolute; left:100; top:10; height:34; width:34">
<img src="http://javascript.internet.com/img/ball-drop/ball.gif" height=30 width=30 alt="bouncing ball">
http://javascript.internet.com/img/ball-drop/ball.gif</div>

<script language="javascript1.2">
<!-- begin
iter = 0;
setid = 0;
down = true;
up = false;
bouncingball = (is.ver5) ? document.getelementbyid("ball").style
: (is.ns) ? document.layers["ball"]
: document.all["ball"].style;
stillball = (is.ver5) ? document.getelementbyid("staticball").style
: (is.ns) ? document.layers["staticball"] : document.all["staticball"].style;
winh = (is.ns) ? window.innerheight - 55 : document.body.offsetheight - 55;
document.onmouseup = buttonup;
if (is.ns4)
document.captureevents(event.mouseup);
function buttonup(e) {
if ( ((is.ns) ? e.which : event.button) != 1) return true;
if (setid != 0) clearinterval(setid);
bouncingball.visibility="visible";
stillball.visibility="hidden";
bouncingball.left = (is.ns) ? e.pagex - 15 : event.offsetx - 15;
bouncingball.top = (is.ns) ? e.pagey - 15 : event.offsety - 15;
iter = 0;
setid = setinterval("generategravity()", 20);
return true;
}
function generategravity() {
if ((parseint(bouncingball.top)+iter < winh) && down) {
bouncingball.top = parseint(bouncingball.top) + iter;
iter++;
return;
}
else {
if ((parseint(bouncingball.top)< winh) && down) {
bouncingball.top = winh + 5;
return;
}
down = false;
up = true;
if (iter < 0 && parseint(bouncingball.top) > winh) {
clearinterval(setid);
bouncingball.visibility = "hidden";
stillball.visibility="visible";
setid = 0;
}
if (parseint(bouncingball.top) > 0 && up && iter >= 0) {
bouncingball.top = parseint(bouncingball.top) - iter;
iter--;
if (iter%3 == 0) iter--;
return;
}
down = true;
up = false;
   }
}
// end -->
</script>

<!-- script size:3.46 kb -->
页: [1]
查看完整版本: 图形特效掉落的图片