日期:2014-05-16  浏览次数:20360 次

firefox框架(frameset)js引用问题
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>aaa</title>
<script language="javascript">
function mainCenterClick(){
	try{
		if(main.cols!="6,*") {
			main.cols="6,*";
		}else{
			main.cols="191,*"
		}
		leftFrame.centerClick();
	}catch (e){
		alert(e);
	}
}
</script>
</head>
<frameset rows="50,*" frameborder="0" border="0" framespacing="0">
	<frame name="daoHangTiao" id="daoHangTiao" src="top.action" scrolling="no" frameborder="0" noresize></frame>  
	<frameset name="main" id="main" cols="191,*" scrolling="no"  frameborder="0" border="0" framespacing="3">
		<frame name="leftFrame" id="leftFrame" scrolling="no" src="left.action" frameborder=0 scrolling="no" marginwidth="0" marginheight="0" border=0 framespacing="0"></frame>
		<frame name="right" id="right" src="info.action" scrolling="auto" border=0 frameborder=0 framespacing="0"></frame>
	</frameset>
	<noframes><body>很抱歉,阁下使用的浏览器不支援框架功能,请转用新的浏览器。</body></noframes> 
</frameset>
<noframes></noframes> 
</html>
 

?该段代码在IE上能运行,但是在FF上确执行出异常。

?

将mainCenterClick方法改为

function mainCenterClick(){
	var _main = window.parent.document.getElementById('main')
	try{
		if(_main.cols!="6,*") {
			_main.cols="6,*";
		}else{
			_main.cols="191,*"
		}
		leftFrame.centerClick();
	}catch (e){
		alert(e);
	}
}
?