对于frameset frames 框架即可拖动又可隐藏显示的问题,搜了好多网上答复,都没很满意的结果,于是自己在JS菜鸟的情况下惊人的用了三天时间终于憋出一下代码:
自己写: function show(){
if(window.parent.baobao.cols == '236,*'){
window.parent.baobao.cols = '0,*';
}else{
window.parent.baobao.cols = '236,*';
}
}
自己写的简单代码,竟然可以,兴奋了半天后,用绝对公正绝对标准的火狐打开后!哭了半休……
还得在网上继续查:
function show(){
var fs=window.parent.document.getElementsByTagName("frameset");
//fs 可以得到frameset的数组 我们需要控制的是第二个 数组下标为1
var display=false;
if(!display){
fs[1].cols = '0,*';
display=true;
}else{
fs[1].cols = '236,*';
display=false;
}
}
网上查到的却只能打开隐藏不了,郁闷坏了!无耐,找到了我的好友……老杨!!
后与我一同事高手携手针对问题分析过后,主要为代码标准问题!!修改后为:<SCRIPT>
function oa_tool(){
var frameshow=document.getElementById("frameshow");
var fs=window.parent.document.getElementsByTagName("frameset"); if(fs[1].cols=="236,*"){
//alert("false----------");
frameshow.src="images/dakaiz.gif";
frameshow.title="显示工具栏";
fs[1].cols="8,*";
}else{
frameshow.src="images/guanbiz.gif";
frameshow.title="隐藏工具栏";
//alert(fs[1].cols);
fs[1].cols="236,*";
}
}
</SCRIPT>ok……成功!!!!睡觉…………………………
自己写: function show(){
if(window.parent.baobao.cols == '236,*'){
window.parent.baobao.cols = '0,*';
}else{
window.parent.baobao.cols = '236,*';
}
}
自己写的简单代码,竟然可以,兴奋了半天后,用绝对公正绝对标准的火狐打开后!哭了半休……
还得在网上继续查:
function show(){
var fs=window.parent.document.getElementsByTagName("frameset");
//fs 可以得到frameset的数组 我们需要控制的是第二个 数组下标为1
var display=false;
if(!display){
fs[1].cols = '0,*';
display=true;
}else{
fs[1].cols = '236,*';
display=false;
}
}
网上查到的却只能打开隐藏不了,郁闷坏了!无耐,找到了我的好友……老杨!!
后与我一同事高手携手针对问题分析过后,主要为代码标准问题!!修改后为:<SCRIPT>
function oa_tool(){
var frameshow=document.getElementById("frameshow");
var fs=window.parent.document.getElementsByTagName("frameset"); if(fs[1].cols=="236,*"){
//alert("false----------");
frameshow.src="images/dakaiz.gif";
frameshow.title="显示工具栏";
fs[1].cols="8,*";
}else{
frameshow.src="images/guanbiz.gif";
frameshow.title="隐藏工具栏";
//alert(fs[1].cols);
fs[1].cols="236,*";
}
}
</SCRIPT>ok……成功!!!!睡觉…………………………
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>top</title>
<style type="text/css">
<!--
* {
margin:0;
padding:0;
}
-->
</style>
</head><body>
top
</body>
</html>
left.html页面<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>left</title>
<style type="text/css">
<!--
* {
margin:0;
padding:0;
}
-->
</style>
<script language="javascript">
function oa_tool(){
var frameshow=document.getElementById("frameshow");
var fs=window.parent.document.getElementsByTagName("frameset"); if(fs[1].cols=="236,*"){
//alert("false----------");
frameshow.src="images/dakaiz.gif";
frameshow.title="显示工具栏";
fs[1].cols="8,*";
}else{
frameshow.src="images/guanbiz.gif";
frameshow.title="隐藏工具栏";
//alert(fs[1].cols);
fs[1].cols="236,*";
}
}
</script></head><body style="overflow-x:hidden;">
<div>asdasdas</div>
<div style="position:absolute; top:0; right:0; height:100%; width:7px; background:#666;"><img id="frameshow" src="images/guanbiz.gif" onclick="oa_tool()" width="7" height="86" /></div>
</body>
</html>main.html页面<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>main</title>
</head>
<frameset rows=73,*>
<frame name="banner" marginWidth="20" marginHeight="6" src="top.html" noResize scrolling="no" target="contents">
<frameset id="frameset" rows="*" cols="236,*" framespacing="1" frameborder="yes" border="1">
<frame name="contents" src="left.html" id="left" target="main">
<frame src="right.html" name="main" id="right" frameborder="no">
</frameset>
<noframes></noframes>
</frameset></html>right.html页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>right</title>
<style type="text/css">
<!--
* {
margin:0;
padding:0;
}.tuodong{
position:absolute;
top:0; left:0;
height:100%;
width:7px;
background:#666;
}
-->
</style>
</head><body>
<div>right</div>
</body>
</html>