<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>定时器 延时调用setTimeout</title> <!-- setTimeout("代码a",n);Performing open page n milliseconds Code A -> the clearTimeout (the setTimeout ()); cancel the setTimeout (); </ Head > < body > < Script > var X; // global variables X function A () { X = the setTimeout ( " document.write ( 'Show me after 5 seconds') " , 1000 ); // timing codes assigned to the X } function B () { the clearTimeout (X); // Clear X } A (); // call A B (); // call B </ Script > </ body > </ HTML>
Timer delay calling setTimeout
Guess you like
Origin www.cnblogs.com/vinson-blog/p/12077403.html
Ranking