frameset与iframe操作
都可以用parent.id得到对象
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>产品展示系统 管理员登录 Produces_View</title>
</head>
<frameset rows="28,*,28" framespacing="0" frameborder="0" border="false" id="frame" scrolling="yes">
<frame name="top" scrolling="no" marginwidth="0" marginheight="0" src="Admin_Index_Top.html">
<frameset framespacing="0" id="frame1" frameborder="0" border="false" cols="210,*" scrolling="yes">
<frame name="left" scrolling="no" src="Admin_Index_Left.html">
<frame name="main" scrolling="auto" src="Admin_Index_Main.html">
</frameset>
<frame name="buttom" scrolling="no" marginwidth="0" marginheight="0" src="Admin_Index_buttom.html">
</frameset>
<noframes>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<p>你的浏览器版本过低!!!本系统要求IE5及以上版本才能使用本系统。</p>
</body>
</noframes>
</html>
noresize框架不能拖动属性,放在frameset 的 frame中
以上可以用window.top.frames['left'].location设置链接,window.top.frames[1].name得到left
<html>
<head></head>
<body>
<table>
<tr><td id="aa">aa<iframe frameborder="0" src="admin_index_top.html"></iframe></td></tr>
</table>
</body>
</html>
admin_index.top.html
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="Css/admin.css" type=text/css rel=stylesheet>
<title></title>
</head>
<script language="javascript">
var displayBar=true;
function ShowHideMenu(obj)
{alert(parent.frame1.name);
if (displayBar)
{
parent.frame1.cols="0,*";
displayBar=false;
obj.title="打开左边管理导航菜单";
}
else{
parent.frame1.cols="210,*";
displayBar=true;
obj.title="关闭左边管理导航菜单";
}
}
</script>
<body topmargin="0" leftmargin="0" oncontextmenu="return true;">
<TABLE height="30" cellSpacing="0" cellPadding="3" width="100%" align="center" border="0">
<TR>
<TD align="center" width="198" bgColor="#59a8ce" height="30"><A class="b" style="cursor:pointer; " title="关闭左边管理导航菜单" onClick="javascript:ShowHideMenu(this);">显示/隐藏菜单</A></TD>
<TD align="right" width="783" bgColor="#59a8ce"><a id="lbExit" class="b" style="cursor:pointer; " onClick="alert(window.parent.aa.innerHTML);">退出系统</a></TD>
</TR>
</TABLE>
</body>
</html>
以上可以用window.parent.aa.innerHTML得到html值,也可以用window.parent.document.getElementById('aa').innerHTML得到html值
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>产品展示系统 管理员登录 Produces_View</title>
</head>
<frameset rows="28,*,28" framespacing="0" frameborder="0" border="false" id="frame" scrolling="yes">
<frame name="top" scrolling="no" marginwidth="0" marginheight="0" src="Admin_Index_Top.html">
<frameset framespacing="0" id="frame1" frameborder="0" border="false" cols="210,*" scrolling="yes">
<frame name="left" scrolling="no" src="Admin_Index_Left.html">
<frame name="main" scrolling="auto" src="Admin_Index_Main.html">
</frameset>
<frame name="buttom" scrolling="no" marginwidth="0" marginheight="0" src="Admin_Index_buttom.html">
</frameset>
<noframes>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<p>你的浏览器版本过低!!!本系统要求IE5及以上版本才能使用本系统。</p>
</body>
</noframes>
</html>
noresize框架不能拖动属性,放在frameset 的 frame中
以上可以用window.top.frames['left'].location设置链接,window.top.frames[1].name得到left
<html>
<head></head>
<body>
<table>
<tr><td id="aa">aa<iframe frameborder="0" src="admin_index_top.html"></iframe></td></tr>
</table>
</body>
</html>
admin_index.top.html
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="Css/admin.css" type=text/css rel=stylesheet>
<title></title>
</head>
<script language="javascript">
var displayBar=true;
function ShowHideMenu(obj)
{alert(parent.frame1.name);
if (displayBar)
{
parent.frame1.cols="0,*";
displayBar=false;
obj.title="打开左边管理导航菜单";
}
else{
parent.frame1.cols="210,*";
displayBar=true;
obj.title="关闭左边管理导航菜单";
}
}
</script>
<body topmargin="0" leftmargin="0" oncontextmenu="return true;">
<TABLE height="30" cellSpacing="0" cellPadding="3" width="100%" align="center" border="0">
<TR>
<TD align="center" width="198" bgColor="#59a8ce" height="30"><A class="b" style="cursor:pointer; " title="关闭左边管理导航菜单" onClick="javascript:ShowHideMenu(this);">显示/隐藏菜单</A></TD>
<TD align="right" width="783" bgColor="#59a8ce"><a id="lbExit" class="b" style="cursor:pointer; " onClick="alert(window.parent.aa.innerHTML);">退出系统</a></TD>
</TR>
</TABLE>
</body>
</html>
以上可以用window.parent.aa.innerHTML得到html值,也可以用window.parent.document.getElementById('aa').innerHTML得到html值
lei1217