An example to demonstrate how start interval & stop it using javascript.
var x = window.setInterval(
function(greeting, name){
var m = document.createElement("div");
with(m.style){
height = "2px";
width = "50px";
position = "relative";
backgroundColor= "green";
}
document.body.appendChild(m);
},
1000,
"hello",
"world",
document.body.onclick = function(){
clearInterval(x)
}
);
Tags: Javascript
cool, post some more if possible!!! i forgot java now.
more posts going to come soon.
By the way, that’s Javascript, not Java