Jump to content

clearInterval()


zenon905

Recommended Posts

var intfunction gen(){	var int=setInterval('lot()', 1)}function lot(){	var ran=Math.floor(Math.random()*11)	document.getElementById("box").value=ran}function num(){	clearInterval(int)}<input type=button id='a' value="Start The Numbers" onclick=gen()><p><input type=button id='b' value="Take Your Chance!" onclick=num()><p>

When I click button b, it doesn't stop the interval and it still continues to work. I tried int=window.clearInterval(int) and var int=self.setInterval like from the clock example, but it still doesn't work.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...