目标:单击图片使用左边的frame收缩。
<frameset rows="89,*" frameborder="0" framespacing="0" border="0" style=" overflow:hidden">
<frame src="header.html">
<frameset cols="235,7,*" id="bottom">
<frame src="control.html" style="overflow-x:hidden">
<frame src="switch.html" name="switch" frameborder="no" scrolling="no" noresize="">
<frame src="addGoods.html">
</frameset>
其中switch.html对应的代码如下:
<html>
<head>
<title>折叠/展开</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function changeWin(){
if(window.parent.bottom.cols == "235,7,*")
{
top.bottom.cols = "0,7,*";
document.getElementById('menuSwitch').innerHTML = "<img src='../images/cc2.gif' width=6 height=50>";
}
else
{
top.bottom.cols = "235,7,*";
document.getElementById('menuSwitch').innerHTML = "<img src='../images/cc.gif' width=6 height=50>";
}
}
</script>
</head>
<body bgcolor="#EEEEEE" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" οncοntextmenu="return false">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tbody>
<tr>
<td width="100%" height="100%" id="menuSwitch" onClick="changeWin()" title="折叠/展开菜单" style="cursor:pointer"><img src="../images/cc.gif" name="ff" width="6" height="50"></td>
</tr>
</tbody>
</table>
</td>
<td height="100%" width="1" bgcolor="#dddddd"></td>
</tr>
</tbody>
</table>
</body>
</html>
在IE和firefox里才能正常使用,唯独chrome报错:
不安全?我汗,怎么也不知道怎么解决,后来在一文中找到答案,放在tomcat里就完全正常了,再汗。。。