- 我有两个jsp页面。1.customer.jsp 2.menuBanner.jsp
- customer.jsp 在其内容的顶部有一个 iframe。iframe 只不过是 menuBanner.jsp 文件。
- menubanner.jsp 只有两个内容。一个图像和一个按钮。单击按钮时,它必须打开一个对话框。对话框代码应该在 menubanner.jsp 页面中。
- 当我单击此 url host:port/example/menuBanner.jsp 中的按钮时,出现对话框并且对话框位于页面中心。
- 但是当我从这个 url host:port/example/customer.jsp 尝试时,对话框粘在页面顶部,也没有得到框的高度。
- 我的需要是,当我从这个 url 尝试主机:port/example/customer.jsp 时,我必须在页面中心获取对话框。我的意思是它应该在 customer.jsp 页面内容的顶部。
问问题
282 次
1 回答
1
你的 iframe 和页面在同一个域上很好,这意味着你可以在 javascript 中的父/子之间来回调用。
我建议在您的父级 (customer.jsp) 中设置一个 javascript 函数
function drawBox() {
//handle drawing the box here however that has to happen
}
在 menuBanner.jsp 中更新按钮以触发“parent.drawBox()”
onclick="parent.drawBox()"
这是此工作的示例:http: //mathforum.org/~amir/share/stack/outer.html
于 2013-02-20T07:03:46.330 回答