//指定時間之後跳轉
<script language="javascript">
function go( ) {//定義函數
window.location="main.html";//頁面跳轉
}
window.setTimeout("go()",1000);//1秒後執行函數go
</script>
//指定時間之後自動關閉
<script type="text/javascript">
function closeMyWindow() {
window.setTimeout("window.close()", 1000);
}
</script>
<body>
<div>
<!--Chrome IE有效,FireFox無效-->
<input type="button" value="return closeMyWindow()" onclick="return closeMyWindow()" />
<br />
<!--Chrome IE有效,FireFox無效-->
<input type="button" value="onclick='closeMyWindow()'" onclick="closeMyWindow()" />
<br />
<!--IE有效,FireFox無效-->
<a href="#" onclick="closeMyWindow()">'closeMyWindow()'</a>
<br/>
<!--Chrome IE有效,FireFox無效-->
<a href="#" onclick="window.close()">'window.close()'</a>
<br/>
</div>
</body>