<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript"> var IE = document.all?true:false var tempX = 0 var tempY = 0 var XX = 0 var YY = 0 var YYY = 0 var DELAY = 100; function update(){ if ( tempX > XX ){XX++;}else if( tempX < XX ){XX--;} if ( tempY > YY ){YY++;}else if( tempY < YY ){YY--;} document.getElementById('xxx').value = "X:" + XX; document.getElementById('yyy').value = "Y:" + YY; document.getElementById('blok').style.width = XX + "px"; document.getElementById('blok').style.height = YY + "px"; document.getElementById('blok').style.left = XX + "px"; document.getElementById('blok').style.top = YY + "px"; window.YYY = document.getElementById('xxx').value.toString(); document.getElementById('info1').value = "D" + DELAY; document.getElementById('info2').value = tempX; if(DELAY > 0){ DELAY--;} } function checker(){ if( tempX != XX || tempY != YY){ setTimeout("update()", DELAY); } else{ DELAY = 100; } } function getMouseXY(e) { if (window.IE) { // grab the x-y pos.s if browser is IE tempX = event.clientX + document.body.scrollLeft tempY = event.clientY + document.body.scrollTop } else { // grab the x-y pos.s if browser is NS tempX = e.pageX tempY = e.pageY } // catch possible negative values in NS4 if (tempX < 0){tempX = 0} if (tempY < 0){tempY = 0} return true } function count(){ setInterval("checker()", 1); if (!IE) document.captureEvents(Event.MOUSEMOVE) document.onmousemove = getMouseXY; } </script> </head> <body> <div id="blok" style="background-color: aqua; width: 500px; position: absolute; t"> <input id="xxx" name="strength" value="" /> <input id="yyy" name="strength" value="" /> </div> <input id="info1" name="strength" value="" /> <input id="info2" name="strength" value="" /> </body> </html>
Czy ktoś miałby pomysł jak to zrobić
