日期:2014-05-17  浏览次数:20636 次

frameset中一个frame中的按钮怎么刷新另外两个frame中的页面?
<frameset cols="25%,75%" id="fs">
<frameset rows="35%,70%">
<frame src="./jsp/condition.jsp" name="condition" noresize="noresize">
<frame src="./jsp/tree.jsp" name="tree">
</frameset>
<frame src="./jsp/detail.jsp" name="detail">
</frameset>
大概的frame结构就是上面那样,在condition.jsp中有个button,点击以后,回去后台数据库取数据,怎么样才能同时把检索出来的数据反映到tree.jsp跟detail.jsp中呢?我这边的大体框架是用struts搭的。。多谢看贴回帖的兄弟们哈

------解决方案--------------------
tree.jsp跟detail.jsp

window.onload = function() {
//ajax.....
}

button.onclick = function() {
tree.location = "tree.jsp";
detail.location = "detail.jsp";
}

大概就是这个样子了。
------解决方案--------------------
button.onclick = function() {
tree.location = "tree.jsp";
detail.location = "detail.jsp";
}

改成
button.onclick = function() {
tree.location = "tree.action";
detail.location = "detail.action";
}


------解决方案--------------------
window.parent.frames["tree"].location.reload();看看能不能用吧 这个只能刷新页面 你也可以window.parent.frames["tree"].定义的方法名比如refreshPage(参数);你看看能用吗。
------解决方案--------------------

<script type="text/javascript">

var menuContentLeft = 你的frame的name属性;
parent.menuContentLeft.location.reload(); 
 
</script>
在每个JSP里加上这个,试试吧。。。。
------解决方案--------------------
探讨
是这样,要是action的方式返回数据的话,我总觉是serverlet直接把actionFrom上的数据直接对应到想要跳转的画面上去了,这样的话,是不是只能在再一个画面更新完成以后,再更新另外一个画面?方法大概就是类似window.parent.frames["tree"].location.reload()的

------解决方案--------------------
window.parent.frames["tree"].location.reload()
这种方式是可以的。
还有二楼的方式也是可行 的。
------解决方案--------------------
要不你试试在tree和detail的onload 事件里面跳转this.location=xxx.action
多试试。。
------解决方案--------------------
可以考虑在condition.jsp上根据分别设置2个Form,然后通过target="tree"和target="detail"将其submit到那2个frame中