<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en-US">
<head><title>Click the Button</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript"><!--
function moveObj(obj){
var w = 600, h = 400;
newWidth = Math.floor(Math.random()*w);
newHeight = Math.floor(Math.random()*h);
obj.style.position="absolute";
obj.style.left=newWidth+"px";
obj.style.top=newHeight+"px";
}
function checkObj(event,obj){
var top = obj.style.top.split("px")[0];
var left = obj.style.left.split("px")[0];
if(top+5 > event.y || left+5 > event.x){moveObj(obj);}
}
window.setTimeout("checkObj(event,document.forms[0].elements[0]", 1);
document.onkeydown = function(){return false;}
//--></script>
</head>
<body onMouseMove="checkObj(event,document.forms[0].elements[0]);" onKeyPress="return false;">
<form action="" name="frm"><div>
<input type="button" value="Click Me Phragle!" onMouseOver="moveObj(this);" onClick="alert('Good Job');">
</div></form>
</body></html>
Test it here:
http://jmarshall.com/easy/html/testbed.html