【问题标题】:jsp function works in IE but not chrome or firefoxjsp 函数在 IE 中有效,但在 chrome 或 firefox 中无效
【发布时间】:2015-04-22 17:40:18
【问题描述】:

以下代码是在处理用户可以关闭的命令时出现的对话框。它可以在 IE 中运行,但 Chrome 和 Firefox 不允许在运行后将其关闭。

<a4j:status id="statusWaitInt" forceId="true"
            onstart="javascript:Richfaces.showModalPanel('waitModalPanel2');"
            onstop="javascript:Richfaces.hideModalPanel('waitModalPanel2');">
    </a4j:status>
    <rich:modalPanel id="waitModalPanel2" autosized="true" width="200" height="50" resizeable="false">
            <f:facet name="header">
                <h:panelGrid columns="2" width="100%">
                    <h:outputText value="IWS Processing..." styleClass="textLabel"/>            
                    <h:graphicImage value="/images/close.jpg" style="cursor:pointer;float:right;" onclick="Richfaces.hideModalPanel('waitModalPanel2')" />
                </h:panelGrid>
            </f:facet>
             <h:panelGrid style="margin:auto">
                <rich:spacer height="5px"/>
               <h:graphicImage  value="/images/ajax-loader1.gif"/>
            </h:panelGrid>
    </rich:modalPanel>

这是从中生成的 html:

    </head><span id="waitStatus"><span id="waitStatus.start" style="display: none"></span><script type="text/javascript">
    window.document.getElementById('waitStatus.start').onstart=function(){javascript:Richfaces.showModalPanel('waitModalPanel');;};
</script><span id="waitStatus.stop"></span><script type="text/javascript">
    window.document.getElementById('waitStatus.stop').onstop=function(){javascript:Richfaces.hideModalPanel('waitModalPanel');;};
</script></span><div id="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanel" style="display: none;"><input autocomplete="off" id="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanelOpenedState" name="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanelOpenedState" type="hidden" /><div class="rich-modalpanel " id="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanelContainer" style="position: absolute; display: none; z-index: 100; background-color: inherit;"><div class="rich-mpnl-mask-div-opaque rich-mpnl-mask-div" id="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanelDiv" style="z-index: -1;"><button class="rich-mpnl-button" id="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanelFirstHref"></button></div><div class="rich-mpnl-panel"><div class="rich-mp-container" id="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanelCDiv" style="position: absolute; left: 0px; top: 0px; z-index: 9;"><div class="rich-mpnl-shadow" id="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanelShadowDiv"></div><div class=" rich-mpnl-content" id="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanelContentDiv"><table border="0" cellpadding="0" cellspacing="0" class="rich-mp-content-table" id="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanelContentTable" style="width: 200px;height: 50px;"><tr style="height: 1%;"><td class="rich-mpnl-header-cell"><div class="rich-mpnl-text rich-mpnl-header " id="pbG182563ee_2d855a_2d4d65_2d8443_2d55f7fefd57c7:_viewRoot:j_id0:waitModalPanelHeader" style="white-space: nowrap;"><table width="100%">
<tbody>
<tr>
    <td><span class="textLabel">IWS Processing...</span></td>
<td><img src="/iws-vault/images/close.jpg" onclick="Richfaces.hideModalPanel('waitModalPanel');" style="cursor:pointer;float:right;" /></td>

【问题讨论】:

  • 生成的 HTML 是什么样的?
  • @ShadowCat7 它是一个带有 X 的弹出框,用于在右上角关闭。图形图像是 X
  • 我的意思是你能在你的问题中提供生成的 HTML/JavaScript 吗?问题可能就在那里。
  • 我不确定在哪里可以找到或如何找到 @ShadowCat7。上面是jsp文件
  • 这里是@ShadowCat7

标签: google-chrome internet-explorer jsf firefox richfaces


【解决方案1】:

弹出式面板的经验法则是它们应放置在将触发它们的&lt;h:form/&gt; 之外。然后弹出面板可以包含它自己的&lt;h:form/&gt;

针对您的具体问题,richfaces 3.x 对 rich:modalPanel 做出了特殊让步,以便在 IE 中使用。来自the doc

为了避免 IE 中的 bug,对话框的根节点被移动到了 DOM 树的顶部。

您还应该知道,根据 Brian Leathem(Richfaces 负责人)RF 3.x is compatible only with IE <= 8987654322@

【讨论】:

  • 所以对我来说最好的办法是升级我的 RichFace 库?另外,你怎么知道我运行的是 3.x?
  • 抱歉,我是 Richfaces 平台的新手。
  • 抱歉忘记标记你
  • modalPanel 在 RF3 之后被停用;您可能最终应该升级,但请务必阅读有关迁移过程的资源。现在,你可以应用我的推荐@user4820744
  • 我现在在
    标签中没有它,所以你说我应该添加它? @kolossus
猜你喜欢
  • 2023-04-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多