只能在自己的浏览器上运行,这应该算简洁了吧
<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body onload="sec()">
<!--先编写好网页布局-->
<h3>操作成功</h3>
<p><span id="aaa">5</span>秒后返回到主页 <a href="#" onclick="goBack()">返回</a></p>
<script type="text/javascript">
function goBack(){
window.open("http://www.imooc.com/");
}
var num=5;
function sec(){
if(num > 0){
document.getElementById("aaa").innerHTML = num;
num = num - 1;
setTimeout("sec()",1000);
}else{
window.open("http://www.baidu.com/","_self");
}
}
</script>
</body>
</html>