$(function(){
var handler = function() {
}
var timer = setInterval( handler , 1000);
var clear = function(){
clearInterval(timer);
}
} );
I want to add a page jump to the timing, and then load the timer when the page loads. How to write it?
What you want to achieve is like how many messages are prompted on Baidu where instant messaging is initiated. I have a method to query the number of items in java. How to write js?
Timer: is used to specify a program to be executed after a specific period of time.
Timing execution in JS, the difference between setTimeout and setInterval, and the l release method
setTimeout(Expression, DelayTime), after DelayTime, Expression will be executed once, setTimeout is used to delay for a period of time, Do something again.
setTimeout("function", time) Set a timeout object
setInterval(expression, delayTime), each DelayTime will execute Expression. It can often be used to refresh expressions.
setInterval(" function", time) Set a timeout object
SetInterval to repeat automatically, setTimeout will not repeat.
clearTimeout(object) clears the setTimeout object
clearInterval(object) clears the setInterval object
setTimeout(aa(),1000) //Unit milliseconds
function aa()
{
location.href('address' );
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn