<body>
<div id="myImg" style="position: absolute; 100px;height: 100px;background-color: pink;border: red solid 2px; border-radius: 20px;">
<!--<img style=' 200px;' src="img/Clocks.gif">-->
</div>
<script>
var myImg = document.getElementById('myImg');
document.onkeydown = keyDown;
function keyDown(event){
switch (event.keyCode){
case 87:
myImg.style.top = myImg.offsetTop - 5+'px';
break;
case 83:
myImg.style.top = myImg.offsetTop + 5+'px';
break;
case 65:
myImg.style.left = myImg.offsetLeft - 5+'px';
break;
case 68:
myImg.style.left = myImg.offsetLeft + 5+'px';
break;
default:
break;
}
}
</script>
</body>