日期:2009-06-28  浏览次数:21138 次

来几段有趣的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 >