模态窗口

主窗口代码:

1 var url = "";
2 window.showModalDialog(url,window);
// 这里的url可以是一个页面路径,也可以是action方法。

子窗口获取主窗口的document的代码:

1 var isMSIE= (navigator.appName == "Microsoft Internet Explorer");
2 var win = null;
3 if (isMSIE) {
4 win = window.dialogArguments;
5 } else{
6 win = window.opener;
7 }
8 win.document.getElementById("classId").title=classId;
9 window.close();

 ie和其它获取主窗口的document不一样。

在模态窗口中的链接总是在新窗口中打开,解决方法:

1 //在head中添加的代码
2  <base target='_self'>

posted on 2011-06-07 17:35  缘^_^  阅读(211)  评论(0)    收藏  举报

导航