I have tried many ways to make the button avoid the mouse. I have tried all the onmouse functions, yet they don't seem to work, btw I am trying to make the button get the size of the computers screen, and make the button move all around the screen. Here is the code that I have:
<body onload="WindowResize()">
<div class="align-topleft">
<button onmouseover="moveObj(this)" id="ClickMe" class="btn" type="button">Click Me...</button>
</div>
<script>
function moveObj(obj){
var w = window.screen.width, h = window.screen.height; // width and height
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);}
}
//--></script>
<script>
function WindowResize()
{
window.screen.width
window.screen.height
}
</script>
</body>
</html>