首页 新闻 会员 周边

window.open 页面开没打开就执行下面的了!我想弹窗窗口关闭在执行下面的!!求帮助啊!

0
[已解决问题] 解决于 2015-10-14 09:42

一个父页面:按钮事件

function isOK() {
            //以前写的这个可以传值,但浏览器不兼容showModalDialog

            //var strReturn = window.showModalDialog('HTMLPage.html ', 'window ', 'help=0;status=0;dialogWidth=870px;dialogHeight=600px; ');
           var strReturn = window.open('HTMLPage.html','window', 'height=600,width=870,top=100,left=100,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')

           if (window.open) {
               alert("打开");
               if (window.document.getElementById("divee").innerHTML.toString == "sadasd") {
                   alert("获取就跳转");
                   self.location = "Disclosure.aspx";
               } else {
                   alert("未获取不做操作");
               }
               

           }
        }

一个子页面:

有2个按钮:确定 取消

点击确定:

function ButtonOK_onclick() {

            window.opener.document.getElementById("divee").innerHTML = "sadasd";
            
            self.opener =null; ;
           
            self.close();
           
        }
问题补充:

每次打开窗口 父页面就执行下面  if (window.open) 判断了。那么弄啊!!

温柔的意外的主页 温柔的意外 | 初学一级 | 园豆:18
提问于:2015-10-13 16:00
< >
分享
最佳答案
0

调用负页面方法

function ButtonOK_onclick() {

window.opener.setValue("111");
window.close();

}

跳转

function setValue(m_strValue) {
var namevou = m_strValue;

if (namevou == "111") {
this.location = "Disclosure.aspx";

}
}

温柔的意外 | 初学一级 |园豆:18 | 2015-10-14 09:41
其他回答(1)
0

你是想 var strReturn = window.open...

然后 if (strReturn)?

if(window.open) 永远为true吧?

之奇一昂 | 园豆:1421 (小虾三级) | 2015-10-13 16:08

 我是想弹窗关闭,根据他(子页面)选择的按钮判断进行跳转!

支持(0) 反对(0) 温柔的意外 | 园豆:18 (初学一级) | 2015-10-13 16:15

@温柔的意外: window.document.fn0 = function(){ alert("from window fn0 invoked")}

然后被打开的页面if(window.opener) window.opener.document.fn0();

支持(0) 反对(0) 之奇一昂 | 园豆:1421 (小虾三级) | 2015-10-13 20:05

@之奇一昂: 子页面调用父页面方法?我用了页面可以关闭。就是不跳转?我用的是Chrome

支持(0) 反对(0) 温柔的意外 | 园豆:18 (初学一级) | 2015-10-14 09:25

@温柔的意外: http://blog.csdn.net/tegwy/article/details/7735814

支持(0) 反对(0) 之奇一昂 | 园豆:1421 (小虾三级) | 2015-10-14 09:50
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册