日期:2014-05-16 浏览次数:20508 次
父窗口中的js
function openwin(){ 
    x=window.showModalDialog("win.html",window,"dialogHeight:200px;dialogWidth:400px;center:yes;help:No;resizable:No;status:No;"); 
    if (x=="haha"){//当关闭时,判断返回值
        alert(x);//关闭窗口后激活alert
    }
  } 
子窗口中的js
function closethis(){ 
       Window.returnValue = "haha"; //定义返回值
      close(); 
} 
<input type="button" onclick="closethis()" value="关闭" />
当触发onclick事件时调用closethis()函数 该函数返回"haha"  if (x=="haha")//当关闭时,判断返回值 如果相等则 alert(x).
?