来几段有趣的dhtml,挺好玩的,是做五子棋的时候找来的副产品
咪咪今年有多大了?去过这么多地方,看上去好象比飞哥哥还要大一些似的。
图片我就懒得传了,本来我是用的那个拍翅膀的小天使。
现在只支持netscape 4,赶明儿把ie的做出来。是一个围着鼠标转的小鸟。
<html>
<head>
<title>飞鸟</title>
</head>
<body bgcolor="#505050" text="#ffffff" link="#e0e0e0" vlink="#808080" alink="#ffffff" >
<layer name="a" left="10" top="10" visibility="show" bgcolor="#fffae2" clip="0,0,50,50" >
<img src="flybird.gif"></layer >
<script language="javascript1.2" >
// <!–
var useragent = navigator.appname + " " + navigator.appversion;
var agentinfo = useragent.substring(0, 12);
if (agentinfo >= "netscape 4.0") {
window.captureevents(event.mousemove);
var ybase = window.innerheight/2;
var xbase = window.innerwidth/2;
var delay = 20;
var yampl = 10;
var ymax = 40;
var step = .2;
var ystep = .5;
var currstep = 0;
var tampl=1;
var xpos = 10;
var ypos = 10;
var j = 0;
function movehandler(evnt) {
xpos = evnt.pagex ;
ypos = evnt.pagey ;
}
window.onmousemove = movehandler;
function flybird() {
ybase = window.innerheight / 4;
xbase = window.innerwidth / 4;
document.layers[0].top = ypos + math.cos( ( 20 * math.sin( currstep / ( 20 + j ) ) ) + j * 70 ) * ybase * (math.sin( 10 + currstep / 10 ) + 0.2 ) * math.cos( ( currstep + j * 25 ) / 10);
document.layers[0].left =xpos + math.sin( ( 20 * math.sin( currstep / 20 ) ) + j * 70 ) * xbase * (math.sin( 10 + currstep / (10 + j ) ) + 0.2 ) * math.cos( (currstep + j * 25 ) / 10);
currstep += step;
settimeout("flybird()", delay) ;
}
flybird()
}
// — >
</script >
</body > </html >
