在HTML页面显示等待一定时间后,跳转到其他链接
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>删除成功</title>
</head>
<body>
<p>删除书籍成功,<span id="stime">3</span>秒后返回书籍列表页面......</p>
<script type="text/javascript">
var current_time;
t = setInterval(function () {
current_time = document.getElementById('stime').innerText;
document.getElementById('stime').innerText = current_time - 1;
if (current_time <= 1) {
clearInterval(t);
location.href = '/booklist/';
}
}, 1000);
</script>
</body>
</html>
页面效果: