function move(elementid,xaxis,yaxis,maximum){ moveObject = document.getElementById(elementid); curTop = parseInt(moveObject .offsetTop); curLeft = parseInt(moveObject .offsetLeft); if (xaxis != "0"){ if (curLeft < maximum){ moveObject .style.left = curLeft + xaxis + "px"; } } if (yaxis != "0"){ if (curTop < maximum) { moveObject .style.top = curTop + yaxis + "px"; } } }