23 lines
		
	
	
		
			610 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			23 lines
		
	
	
		
			610 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
|   | --- | |||
|  | title: Window clearInterval Method | |||
|  | localeTitle: Window clearInterval方法 | |||
|  | --- | |||
|  | ## Window clearInterval方法
 | |||
|  | 
 | |||
|  | 'clearInterval()'方法用于清除使用'setInterval()'方法设置的计时器。 | |||
|  | 
 | |||
|  | ```js | |||
|  |     clearInterval(setInteval_ID);  | |||
|  | ``` | |||
|  | 
 | |||
|  | 为了能够使用'clearInterval()'方法,必须使用全局变量。 | |||
|  | 
 | |||
|  | ```js | |||
|  |     myID = setInterval(function, milliseconds);  | |||
|  | ``` | |||
|  | 
 | |||
|  | #### 更多信息:
 | |||
|  | 
 | |||
|  | 文档: [MDN](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/clearInterval) | |||
|  | 
 | |||
|  | 关于[w3schools的](https://www.w3schools.com/jsref/met_win_clearinterval.asp)更多例子 |