例子如下: 1.父頁index.jsp <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"><html xmlns="http ...
例子如下:
1.父頁index.jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<iframe height="100%" width="100%"
frameBorder=0 id=mainFrame name=mainFrame src="<%=path%>/system/manage-layout/main.jsp"
allowTransparency="true"></iframe>
</body>
</html>
2.main.jsp
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<!-- start -->
<div id="default">
</div>
<!-- END -->
<div id="main">
<table width="100%" cellpadding="0" cellspacing="0" class="table_border0" >
<tr>
<!--左側區域start-->
<div id="bs_left">
<td><IFRAME height="100%" width="100%" frameBorder=0 id=frmleft name=frmleft src="<%=path %>/system/manage-layout/left.jsp" allowTransparency="true"></IFRAME></td>
</div>
<!--分隔欄區域start-->
<td class="spliter main_shutiao" targetId="hideCon" beforeClickTip="收縮面板" afterClickTip="展開面板" beforeClickClass="bs_leftArr" afterClickClass="bs_rightArr">
</td>
<!--分隔欄區域end-->
<!--右側區域start-->
</td>
<IFRAME height="100%" width="100%" frameBorder=0 id=frmright name=frmright src="<%=path %>/system/layout_sys/home.jsp" allowTransparency="true"></IFRAME>
</td>
<!--右側區域end-->
</tr>
</table>
</body>
</html>
3.left.jsp
left中的js方法:function loadLeftMenu(parentId){$.ajax({})}
(1)在父頁index.jsp中js方法隱藏main.jsp的div id='default'區可以這樣寫:
window.frames["mainFrame"].document.getElementById("default").style.display="none";
(2)index.jsp中js調left。jsp的方法需要這樣寫:
window.frames["mainFrame"].document.getElementById('frmleft').contentWindow.loadLeftMenu(idx);
如有不妥,繁瑣,請大家批評指正。