读书人

js弹窗(showModalDialog)封闭返回传递

发布时间: 2012-07-04 19:33:54 作者: rapoo

js弹窗(showModalDialog)关闭返回传递参数及激活事件

父窗口中的jsfunction 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    }  } 子窗口中的jsfunction closethis(){        Window.returnValue = "haha"; //定义返回值      close(); } <input type="button" onclick="closethis()" value="关闭" />当触发onclick事件时调用closethis()函数 该函数返回"haha"  if (x=="haha")//当关闭时,判断返回值 如果相等则 alert(x).

?

读书人网 >JavaScript

热点推荐