Nie mam pojęcia jak zatrzymać wykonywany skrypt
Link do Live na w3schools.comkod:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<!-- Copyright Š 2008 nexis.pl -->
<head>
<title>Współrzędne myszki</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript">
function przesunstop(u){
przesun(u);
}
function przesun(a){
if(a==1){
var IE = document.all ? true : false;
if (!IE) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) {
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
} else {
tempX = e.pageX;
tempY = e.pageY;
}
if (tempX < 0){
tempX = 0;
}
if (tempY < 0){
tempY = 0;
}
document.getElementById("x").value = tempX;
document.getElementById("y").value = tempY;
var xxx = 5;
if(tempX>300){
xxx = 300; }else{ xxx = tempX;}
document.getElementById("obiekt2").style.left = xxx+'px'; document.getElementById("oxy").value=document.getElementById("obiekt2").style.left;
document.getElementById("obiekt1").style.left = xxx+'px';
}
}
}
</script>
</head>
<body onmouseup="przesunstop(0)">
<div>
<input type="text" id="x" />
<input type="text" id="y" />
<br>
<img src='http://forum.php.pl/style_images/upgrade_ip/f_hot.gif' style='position: absolute;' id="obiekt2">
<br>
<input id="obiekt1" style='position: absolute;' type="button" onmousedown="przesun(1)" value='->' onmouseup="przesunstop(0)">
<br><br>
<input type="text" id="oxy" />
</div>
</body>
</html>