Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How does setInterval get the Interval value under IE? (urgent)
How does setInterval get the Interval value under IE? (urgent)
The question you asked is very strange. So can IE.

I tried the password.

var intervalId = setInterval(function(){ alert(" a "); }, 1000);

setTimeout(function(){

clearInterval(intervalId)},5000);

It doesn't matter.

Here is all the code, save it as test.html, you can execute it, no problem.

& lt script & gt

var intervalId = setInterval(function(){ alert(" a "); }, 1000);

setTimeout(function(){

clearInterval(intervalId)},5000);

& lt/script & gt;

Why not try it in IE? The code you added is fine.

You just use intervalId as a global variable, and you use jquery, right?

Define global variables, and then clear them.

Write in another way

In the header section of the document

& lt scripting language =' javascript'>

var interva

& lt/script & gt;

The following call is like this.

interval = setInterval(function(){ alert(" a "); }, 1000);

I don't understand what the code here is for.

You rewrote the interval again. Try another name, such as valid 2.

besides

clear interval($(" # interval ")。 val());

This is a character type, and valid is long plastic in IE and plastic in FF. There must be different types here.

$("#play ")。 Click (function () {

clear interval($(" # interval ")。 val());

intervalId = setInterval(interval,click times); $("#intervalId ")。 attr("value ",intervalId);

});