<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<!--先编写好网页布局-->
<h1>操作成功</h1>
<div>
<input id="sec" type="text" value="5"/>秒后回到主页
<input type="button" value="返回" onclick="goBack()"/>
</div>
<script type="text/javascript">
//获取显示秒数的元素,通过定时器来更改秒数。
var second=Number(document.getElementById("sec").value);
//document.write(second);
function changeSecond()
{
if(second >0)
{
second--;
setTimeout("changeSecond()",1000);
}
else
{
open("http://baidu.com","_black","width=900px");
}
}
setTimeout("changeSecond()",100);
//通过window的location和history对象来控制网页的跳转。
function goBack()
{
window.history.back();
}
</script>
</body>
</html>