첫 번째 유형: JS는 정기적으로 창을 자동으로 닫습니다.
<스크립트 언어="자바스크립트">
<!--
함수 closewin()
{
self.opener=null;
self.close();
}
함수시계()
{
나는=i-1
document.title="이 창은 " + i + "초 후에 자동으로 닫힙니다!";
if(i>0)setTimeout("clock();",1000);
그렇지 않으면 closewin();
}
변수 i=10
시계();
//-->
</script>
두 번째 유형: JS 메시지를 표시하지 않고 창을 닫으려면 링크를 클릭하세요.
<a href="javascript:window.close()" >창 닫기</a>
세 번째 유형: 창에 js 코드가 자동으로 닫히도록 요청하지 않습니다.
<스크립트 언어=자바스크립트>
<!--
this.window.opener = null;
window.close();
//-->
</script>
메시지를 표시하지 않고 창을 닫는 IE6-7 JS 방법
방법 1:
JS 코드
function CloseWin() //브라우저를 닫을지 묻는 메시지를 표시하지 않습니다.
{
window.opener=null;
//window.opener=top;
window.open("","_self");
window.close();
}
방법 2:
open.html
JS 코드
함수 open_complex_self() {
var obj_window = window.open('close.html', '_self');
obj_window.opener = 창;
obj_window.focus();
}
닫기.html
JS 코드
window.close();
또한 첨부:
//프롬프트로 정상 닫힘
함수 클로지(){
window.close();
}
//메시지를 표시하지 않고 IE6을 닫습니다.
함수 closeie6(){
window.opener=null;
window.close();
}
//메시지를 표시하지 않고 IE7을 닫습니다.
함수 closeie7(){
window.open('','_top');
window.top.close();
}