案例:从父页面A 通过showmodaldialog的方式 打开模态子页面B,子页面上进行“查询,翻页功能”
1:从父页面A打开子页面B:
var url = "cn.ccb.orms.rcsa.pageflow.RscaQueryItemInfosPopup.flow"; var itemInfo = showModalDialog(url,window,'dialogWidth:800px;dialogHeight:500px;dialogLeft:100px;dialogTop:250px;center:yes;help:yes;resizable:yes;status:yes');
2:进入模态页面B后的JS和JAVA代码
<xmdc:verbatim> <base target="_self" /> </xmdc:verbatim> <xmdc:commandButton action="pageQuery" value="8" styleClass="button_dateset" style="width: 30px; margin-right: 5px" onclick="<span style="margin: 0px; padding: 0px; list-style: none outside none; word-break: normal; word-wrap: break-word; color: rgb(255, 0, 0); ">changeFrame();</span>gotoLastPage(this,'page');" disabled="#{page.isLast==true}"> </xmdc:commandButton> <xmdc:outputText value=" 每页显示" style="padding-top:5px"></xmdc:outputText> <xmdc:inputText id="page_length" value="#{page.length}" style="width:50px" maxlength="9" onkeyup="value=value.replace(/[^\d\.]/g,'');"></xmdc:inputText> <xmdc:outputText value="条转到" style="padding-top:5px"></xmdc:outputText> <xmdc:inputText id="page_currentPage" value="#{page.currentPage}" style="width:50px" maxlength="9" onkeyup="value=value.replace(/[^\d\.]/g,'');"></xmdc:inputText> <xmdc:outputText value="页" style="padding-top:5px"></xmdc:outputText> <xmdc:commandButton action="pageQuery" value="跳转" title="跳转到指定页" styleClass="button" onclick="<span style="margin: 0px; padding: 0px; list-style: none outside none; word-break: normal; word-wrap: break-word; color: rgb(255, 0, 0); ">changeFrame();</span>gotoCustomPage(this,'page');"> </xmdc:commandButton> …… …… …… <xmdc:panelGrid columns="2" border="0" align="center" columnwidths="60px,60px"> <xmdc:commandButton id="queryBtn" action="query" styleClass="button" value="查询" onclick="<span style="margin: 0px; padding: 0px; list-style: none outside none; word-break: normal; word-wrap: break-word; color: rgb(255, 0, 0); ">changeFrame();"</span><span style="margin: 0px; padding: 0px; list-style: none outside none; word-break: normal; word-wrap: break-word; color: rgb(128, 128, 128); ">></</span>xmdc:commandButton> </xmdc:panelGrid> <xmdc:verbatim> <script type="text/javascript"> //初始化提交FORM的TARGET值。 window.attachEvent('onload', function(){ if(window.name=""){ //判断窗体的name,防止查询或者翻页操作时弹出新窗口 document.getElementById("theform").target = "dialogFrame"; }else if(window.name="dialogFrame"){//判断执行查询或翻页操作后,返回当前页面不刷新展现新数据 document.getElementById("theform").target = ""; } }) function changeFrame(){// 判断如果是执行查询或翻页操作,则改变当前窗口form的target值,防止弹出新窗口 document.getElementById("theform").target = "dialogFrame"; } </script> </xmdc:verbatim>