【转】js弹窗(showModalDialog)关闭返回传递参数及激活事件
关于一个js弹出窗口(利用window.showModalDialog弹窗函数),关闭时激活主窗口的某个事件的问题。
主页面中主要代码(index.html):
弹窗主要代码(win.html):
主页面中主要代码(index.html):
程序代码
<script type="text/javascript" src="">
var D=new Function('obj','return document.getElementById(obj)');//通用兼容函数,根据元素ID获取元素对象
function openwin(){ //弹窗
x=window.showModalDialog("win.html",window,"dialogHeight:200px;dialogWidth:400px;center:yes;help:No;resizable:No;status:No;");
if (x=="haha"){//当关闭时,判断返回值
checkother(x);//关闭窗口后激活checkother函数
}
}
function checkother(sstr){//关闭窗口后所调用的函数
D("s1").value="参数是"+sstr;
}
</script>
var D=new Function('obj','return document.getElementById(obj)');//通用兼容函数,根据元素ID获取元素对象
function openwin(){ //弹窗
x=window.showModalDialog("win.html",window,"dialogHeight:200px;dialogWidth:400px;center:yes;help:No;resizable:No;status:No;");
if (x=="haha"){//当关闭时,判断返回值
checkother(x);//关闭窗口后激活checkother函数
}
}
function checkother(sstr){//关闭窗口后所调用的函数
D("s1").value="参数是"+sstr;
}
</script>
弹窗主要代码(win.html):
程序代码
posted on 2010-12-05 12:11 LeeXiaoLiang 阅读(924) 评论(0) 收藏 举报
浙公网安备 33010602011771号