//JS關(guān)閉窗口或JS關(guān)閉頁面的幾種代碼
JS定時自動關(guān)閉窗口
<script language="javascript">
<!--
function closewin(){
self.opener=null;
self.close();}
function clock(){i=i-1
document.title="本窗口將在"+i+"秒后自動關(guān)閉!";
if(i>0)setTimeout("clock();",1000);
else closewin();}
var i=10
clock();
//-->
</script>
第二種:點擊鏈接沒有提示的JS關(guān)閉窗口
<a href="javascript:self.close()" >關(guān)閉窗口</a>
第三種:窗口沒有提示自動關(guān)閉的js代碼
<script language=javascript>
<!--
this.window.opener = null;
window.close();
//-->
</script>
IE6-7 JS關(guān)閉窗口不提示的方法
方法一:
js 代碼 濟(jì)寧網(wǎng)站制作
function CloseWin() //這個不會提示是否關(guān)閉瀏覽器
{
window.opener=null;
//window.opener=top;
window.open("","_self");
window.close();
}
方法二:
open.html
js 代碼
function open_complex_self() {
var obj_window = window.open('close.html', '_self');
obj_window.opener = window;
obj_window.focus();
}
close.html
js 代碼
window.close();
另附:
//普通帶提示關(guān)閉
function closeie(){
window.close();
}
//關(guān)閉IE6不提示
function closeie6(){
window.opener=null;
window.close();
}
//關(guān)閉IE7不提示
function closeie7(){
window.open('','_top');
window.top.close();
}