弹出窗口showModalDialog上提交按钮不打开新网页的补充

showModalDialog弹出的网页,如果有提交按钮,则会打开一个新的IE窗口,无法正常关闭并返回到父

窗口.
网上很多文章都提到在弹出窗口的网页的<head>与</head>之间加入
<base target="_self">可以解决这个问题
确实这个办法在IE5.5以上是可行了,但是在IE5上仍然没有解决这个问题.
而我的使用在很多在网吧上网,用的win98+IE5,以及win2k初始安装后自带的也是IE5
看了SPS的权限管理时用户选择弹出网页,它在win98+ie5下却没有这个问题,所以我相信一定有其它

的办法解决这个问题,在网上找了一下,最后采用frame过渡网页的方案解决了这个问题.

btnuserselect.Attributes.Add ("onClick",ModalWindow("bmsuserlist.htm",550,460));

public string ModalWindow(string openAspxPage,int width,int height)
  {     
   return string.Format("javascript:window.showModalDialog(\"{0}

\",window,\"status:no;center:yes;help:no;resizable:yes;dialogWidth:{1}

px;dialogHeight:{2}px\")",openAspxPage,width,height);   
  }

bmsuserlist.htm
<html>
  <head>
    <title>用户选择</title>   
  </head>
  <frameset rows="0,*">
              <frame src="about:blank">
              <frame src="seleuser.aspx">
       </frameset><noframes></noframes>
</html>

seleuser.aspx
取消按钮
btnno.Attributes.Add("OnClick", "window.parent.close();");
从listbox列表选择值后按确定按钮,返回值并关闭.
btnok.Attributes.Add("OnClick",

"window.parent.dialogArguments.Form1.txtuser.value='"+lb1.SelectedValue

+"|"+lb1.SelectedItem.Text +"';window.parent.close();");


参考:
http://dev.csdn.net/develop/article/15/15113.shtm

posted @ 2008-10-29 19:23  chinaifne  阅读(1614)  评论(0编辑  收藏  举报