頁面佈局:
父頁面 parent.jsp :
<form action="" name="queryForm" id="queryForm" target="">
- - - - - -
<iframe id="search_result" name="search_result" src="" style="border: 0px;" width="100%" height="1000px" frameborder=no scrolling="no" ></iframe>
- - - - - -
</form>
<script language="javascript">
$(function (){
document.getElementById('queryForm').action="<%=path%>/xxx/xxx_xxx.do";
document.getElementById('queryForm').target="search_result";
document.getElementById('queryForm').submit();
}
);
</script>
子頁面 children.jsp :
由parent.jsp頁面的 "<%=path%>/xxx/xxx_xxx.do 獲得 children.jsp 頁面
1.子頁面請求刷新
<script type="text/javascript" src="${webRoot}/javascript/jquery-1.4.2.js"></script>
if(data=='true'){
alert("更新數據成功");
if(jQuery.isFunction(self.parent.frames['search_result'].window.gotoInputPage)) {
self.parent.frames['search_result'].window.gotoInputPage();
}else{
list();
}
}
2.父頁面刷新子頁面
<script type="text/javascript" src="<%=path%>/javascript/jquery-1.4.2.js"></script>
<script src="<%=path%>/js/jquery-1.7.1.min.js"></script>
if(data=='true'){
alert("更新數據成功");
$("#bbc-Handler01").hide();
$('#faqbg').hide();
var result = jQuery.isFunction(window.frames['search_result'].window.gotoInputPage);
if(result) {
window.frames['search_result'].window.gotoInputPage();
}else{
list();
}
window.frames['search_result'].window.gotoInputPage;
}