先定义2个页面 father 和 son
如果是纯html页面的话 father.html son.html,想要弹出子窗口
在father.html中写:
<script type="text/javascript">
function showmessage(){
window.showModalDialog("son.html","window","dialogWidth:500px;DialogHeight=300px;status:no;scroll=no;help:no;resizable:no;toolbar=no; menubar=no;");
}
</script>
在son.html中写:
<script>
function closeSelf(){
//window.location = "/oa/jsp/message/message.jsp";
window.close();
}
</script>
在这里之所以要区分是html页面还是其他页面是有原因的,如果你写的是jsp页面,上面的代码在IE中将无法实现你的设想,在火狐下不影响。
在IE中想要实现你就要把子窗口的页面路径写成绝对的把
window.showModalDialog("son.html","window","dialogWidth:500px;DialogHeight=300px;status:no;scroll=no;help:no;resizable:no;toolbar=no; menubar=no;");
改成
window.showModalDialog("/test/son.html","window","dialogWidth:500px;DialogHeight=300px;status:no;scroll=no;help:no;resizable:no;toolbar=no; menubar=no;");
否则IE无法识别
另外注意你超链接的提交方式:
在html中可以是空链接,但在jsp中改成<a href="javascript:showmessage();">(showmessage()方法为你打开子页面的方法。)
关于这一点,无论是什么浏览器都要修改!