+ 1
How can I do s.th that when r<5 onclick=false
2 Answers
0
I'd add this code to ensure the callback only adds a single setInterval.
var c = 0;
var x;
var r = 328;
function right(){
x = document.getElementById("p")
r=r-5
p.style.right = r + "px";
if(r<5) {
clearInterval(b);
c = 0;
}
}
var b;
function rightd(){
if (c == 0)
{
b = setInterval(right,100);
}
c = c + 1;
}
0
I want it when r<5 and user clicked on the button it doesn't work(it does't move)