十秒后自动关闭页面

1.10s  later ,it will close

<html>
<body onload='setTimeout("mm()",10000)'>

<script>
function mm(){ 

window.close();} 
</script>
hello
</body>
<html>

2.10s later and it turns to new web page.

html>

<head>
<title>10秒后跳转</title>
</head>

<body>
<input type="text" readonly="true" value="10" id="time">
</body>
<script language="javascript">
var t = 10;
var time = document.getElementById("time");
function fun(){
t--;
time.value = t;
if(t<=0){
location.href = "http://www.baidu.com";
clearInterval(inter);
}
}
var inter = setInterval("fun()",1000);
</script>
</html>

posted @ 2012-08-08 16:15  Epirus  阅读(359)  评论(0)    收藏  举报