代码可以跑起来:)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>操作成功</h1>
<span>5</span>
<span>秒后回到主页 </span>
<span><input type="button" id="back" value="返回" /></span>
<script type="text/javascript">
var c = 5;
function count() {
document.querySelectorAll("span")[0].innerHTML = c;
--c;
if (c == 0) {
window.open("http://www.imooc.com/", "_blank");
}
window.setTimeout("count()", 1000);
}
count();
document.querySelector("#back").addEventListener("click", function () { window.history.go(-1); }, true);
</script>
</body>
</html>