[javascript]解决IE7的window.close()弹出确认提示框(转)

一、打开新页面,原页面关闭,且不弹出确认提示框
<a href="javascript:op();">打开</a>
<SCRIPT LANGUAGE="JavaScript">
<!--
var a;
function op(){
    a
=window.open("about:blank","_top");
    a.document.write(
"<a href=\"javascript:self.opener=null;self.close();\">关闭</a>");
}

//-->
</SCRIPT>

 

二、只允许open一次
var newwindow = '';

    
function popitup(url,target) {
     
if (!newwindow.closed && newwindow.location) {
       newwindow.location.href
= url;
     }

     
else {
       newwindow
=window.open(url,target);
      
if (!newwindow.opener) newwindow.opener = self;
     }

     
if (window.focus) {newwindow.focus()}
    
return false;
     }

 

三、直接关闭IE,不弹出确认提示
<SCRIPT LANGUAGE="JavaScript">
<!--
function closeWin(){
    window.open(
"","_self");
   top.opener
=null;
    top.close();
}

//-->
</SCRIPT>

posted @ 2010-06-10 15:45  老蒋  阅读(1272)  评论(0编辑  收藏  举报