Home > Web Front-end > JS Tutorial > Jump effect after 5 seconds (setInterval/SetTimeOut)_javascript skills

Jump effect after 5 seconds (setInterval/SetTimeOut)_javascript skills

WBOY
Release: 2016-05-16 17:34:42
Original
1675 people have browsed it
setInterval版
复制代码 代码如下:

$(function () {
setInterval(function () {
var time = $("#time").text();
time = parseInt(time);
time--;
if (time >0) {
$("#time").text(time);
} else {
window.location = $("#url").attr("href");
}
}, 1000);
});

SetTimeOut版
复制代码 代码如下:



html
复制代码 代码如下:

5秒钟以后跳转到
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template