我想通过A窗体 showModalDialog 出B窗体,然后在B窗体window.location.href=url,在B窗体中出现新的C窗体 而不是弹出一个新的C窗体
我的意思是在showModalDialog 出的B窗体就打开新的链接

解决方案 »

  1.   

    在B窗体的body上面加上这句就可以了 
    <base target="_self">
      

  2.   

    我这里怎么可以...你服务clean下 然后重启下试试
      

  3.   

    我在网上查过 会不会是 window.location.href 的问题 
    但是我需要用javascript 来打开一个新的链接 请问有什么好的办法吗
      

  4.   

    加上<base target="_self">
    肯定是可以的...我就是这么做的.
    不用window.location.href 
    可以用form
    formName.action = url;
    formName.submit();
      

  5.   

    还是是弹出窗体 我贴出我的代码 帮忙看看A:function A(){
        var value = window.showModalDialog(theURL,winName,'dialogHeight: '+height+'px; dialogWidth: '+width+'px; edge: sunken; center: Yes; help: No; resizable: No; status: No;');
        document.forms[0].submit();
        return value;
    }
    B:function B(){
        var url = "#";
        document.location.href=url;
    }在B的
    <title>数据录入</title>
    <base target="_self">
    <body id="mainbody" class="bodybg" leftmargin="0" topmargin="0">
    ....
    </body>
      

  6.   

    给你个方法试试
    A.html
    function A(){
        var value = window.showModalDialog("D.html",winName,'dialogHeight: '+height+'px; dialogWidth: '+width+'px; edge: sunken; center: Yes; help: No; resizable: No; status: No;');
        document.forms[0].submit();
        return value;
    }
    D.html
    <frameset rows="0,*">
      <frame src="about:blank">
      <frame src="B.html">
    </frameset>这样,在B中,只要有target="_self"就行,如<a target="_self",<form target="_self",都可以在showModalDialog中显示
      

  7.   

    var url = "#";
    document.location.href=url;你把url 改成你要跳转的URL 比如a.jsp
      

  8.   

    呵呵  这个 我是省了用了#
    我原来的是
    var url = "<%=context%>/ceip/report/input/RptTplValAction.do?action=toValEdit&valVO.id="+id+"&valVO.orgID="+orgID+"&valVO.date2="+date+"&valVO.orgName="+orgName;
      

  9.   

    我刚才试了下...汗! 
    好象document.location.href 是会跳出页面来,不好意思.误导你了要!
    可以用form 
    formName.action = url; 
    formName.submit();或则直接用<a href=url> 不会 
      

  10.   

    问题终于解决了
    原来是没有目标窗体 
    我在B是这样用的
    window.name="fff";
    function B(){
              var sform = document.forms[0];
    sform.action = url; 
    sform.target="fff";
    sform.submit();
    }
    前面说的<base target="_self">  就用不着了
      

  11.   

    我以前用iframe来做。在module窗口开个等大的iframe打开C窗口。