从弹出窗口调用操作 [英] Calling action from the popup
本文介绍了从弹出窗口调用操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在打开弹出窗口时要面对.
I am facing when i am opening a popup.
<h:form>
<h:commandButton value="Submit" action="#{bean.submit}">
<f:ajax render="popup" />
</h:commandButton>
<h:panelGroup id="popup">
<ui:fragment rendered="#{not empty bean.url}">
<script>window.open('#{bean.url}');</script>
</ui:fragment>
</h:panelGroup>
</h:form>
我想在关闭此弹出窗口时调用一个操作
i want to call an action when i close this popup
第二次,我需要更改此弹出窗口的宽度和高度.
secondly i need to change width and height of this popup.
推荐答案
我们使用onbeforeunload挂钩在弹出窗口时从弹出窗口调用函数
<script>
window.onbeforeunload = function() {
document.forms["showpdf"].elements["hiddenBtn"].click();
}
</script>
<h:body>
<f:view>
<h:form id="showpdf">
<iframe src="#{docProd.url}" width="100%" height="100%"> </iframe>
<div align="center"><p:commandButton id="hiddenBtn"
onclick="#{docProd.resetUrl}" style="display:none" /></div>
</h:form>
</f:view>
</h:body>
</ui:composition>
这篇关于从弹出窗口调用操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文