<head>
<script type="text/javascript">
function setposition(x,y)
{
left = document.getElementById("test" ).style.left;
left = eval(left.substring(0,left.length-2));
document.getElementById("test" ).style.left = left - x + 120 + "px";
top = document.getElementById("test" ).style.top;
top = eval(top.substring(0,top.length-2));
document.getElementById("test" ).style.top = top - y + 120 + "px"; }
</script>
</head>
<body>
<div onclick="setposition(30,30);" id="test" style="position:absolute;top:100;left:100;width:30;height:30;">ok</div>
</body> |