js在frame中操作frameset的cols属性的改变

目标:单击图片使用左边的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报错:

Unsafe JavaScript attempt to access frame with URLfile:///E:/myeclipsework/uushop/WebRoot/control/index.html from frame with URLfile:///E:/myeclipsework/uushop/WebRoot/control/switch.html. Domains, protocols and ports must match.
Uncaught TypeError: Cannot read property 'cols' of undefined

不安全?我汗,怎么也不知道怎么解决,后来在一文中找到答案,放在tomcat里就完全正常了,再汗。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值