Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
#Squrirel {
position:absolute;z-Index:101;left:200px;top:200px;
}
/*]]>*/
</style></head>
<body>
<img id="Squrirel" src="http://mouseprogram.com/squrirel4.jpg" alt="squrirel" onmouseup="SqurirelMove()"/>
<script type="text/javascript">
/*<![CDATA[*/
function Squrirel(o){
Squrirel.img=document.getElementById(o.ID);
Squrirel.ary=o.PositionArray
Squrirel.lst=Squrirel.ary[0];
}
function SqurirelMove(){
var nxt=Squrirel.ary[Math.floor(Math.random()*Squrirel.ary.length)];
if (nxt==Squrirel.lst){
return SqurirelMove();
}
Squrirel.lst=nxt
Squrirel.img.style.left=nxt[0]+'px';
Squrirel.img.style.top=nxt[1]+'px';
}
Squrirel({
ID:'Squrirel',
PositionArray:[
[200,200],
[800,600],
[10,600],
[400,300]
]
})
/*]]>*/
</script>
</body>
</html>
Bookmarks