Method 1: This is a method found online and can be used. But to be honest, I don't quite understand this method. . . It's so complicated to write. How different is this from setTimeout?
function Pause(obj, iMinSecond) {
if (window.eventList == null ) window.eventList = new Array();
var ind = -1;
for (var i = 0; i < window.eventList.length; i ) {
if (window.eventList[i] == null ) {
window.eventList[i] = obj;
ind = i;
break;
}
}
if (ind == -1) {
ind = window.eventList.length;
window.eventList[ind] = obj;
}
setTimeout( "GoOn(" ind ")" , iMinSecond );
}
function GoOn(ind) {
var obj = window.eventList[ind];
window.eventList[ind] = null;
if (obj.NextStep) obj .NextStep();
else obj();
}
function testJsStop() {
alert( "1");
Pause( this, 3000);
this. NextStep = function () {
alert( "2");
}
}
Method 2: This is also found online and can be used. Its principle is to pop up a window first, because when JS pops up the window, the code will pause execution at the current location. Wait for a period of time before executing the window closing function, and the code continues to execute. This method is very simple, but the annoying thing is that it will pop up a window. . .
function pause(numberMillis) {
addcloud() ;
var dialogScript = 'window.setTimeout(' ' function () { $("#bgDiv").remove(); }, ' numberMillis ');';
var result = window.showModalDialog(' javascript:document.writeln(' '"
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31