请大家帮忙,通过javascript控制frameset的row值

yuyeahcool 2011-11-22 04:57:08
请大家帮忙,我想通过通过javascript控制frameset的row值,在frameset里的row值我设的是rows="126,*,90",我想通过javascript得到!浏览器!显示区域的高度,用这个高度减去126,然后付给rows="126,*,90"里面的*。让如下代码的index.html网页显示出来的时候,这个*值就已经是浏览器显示区域的高度减去126了。

现有的html页代码如下:(请大家回帖时帮忙,帮我把代码嵌到下面的代码中,我是生手,javascript和html的好多声明语句和语法规则不是很精通呢)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>

<frameset rows="126,*,90" cols="*" framespacing="0" frameborder="yes" border="5" bordercolor="#3300FF" >
<frame src="top.html" frameborder="yes" name="top" bordercolor="#FFFF00" noresize title="top" scrolling="no">
<frame src="middle.html" frameborder="yes" name="middle" bordercolor="#FF0000" noresize title="left">
<frame src="bottom.html" frameborder="yes" name="bottom" bordercolor="#FFFF00" noresize title="bottom" scrolling="no">

</frameset>

<noframes></noframes>

</head>

<body>
</body>
</html>
...全文
230 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
MuBeiBei 2011-11-22
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 yuyeahcool 的回复:]
MuBeiBei 和liangws能不能加你们QQ?
[/Quote]
9777921
yuyeahcool 2011-11-22
  • 打赏
  • 举报
回复
MuBeiBei 和liangws能不能加你们QQ?
MuBeiBei 2011-11-22
  • 打赏
  • 举报
回复
9777921
yuyeahcool 2011-11-22
  • 打赏
  • 举报
回复
能不能加你qq?
liangws 2011-11-22
  • 打赏
  • 举报
回复
在其中一个frame里面的js加个控制
var topDocument = window.parent.document,
el = topDocument.getElementById("frameId"),
height = topDocument.body.clientHeight;
el.setAttribute("rows","126," + (height - 126) + ",90");
MuBeiBei 2011-11-22
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 yuyeahcool 的回复:]
这段代码我运行了,可是运行不同,是不是不应该把frameset的这套声明放到<body>里啊?
[/Quote]

得放在body标签里,你直接用我的~·看看跟你哪写的不一样
yuyeahcool 2011-11-22
  • 打赏
  • 举报
回复
这段代码我运行了,可是运行不同,是不是不应该把frameset的这套声明放到<body>里啊?
fox123871 2011-11-22
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 mubeibei 的回复:]
HTML code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">……
[/Quote]
+1
MuBeiBei 2011-11-22
  • 打赏
  • 举报
回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>

<frameset id="frameset" rows="126,*,90" cols="*" framespacing="0" frameborder="yes" border="5" bordercolor="#3300FF" >
<frame src="top.html" frameborder="yes" name="top" bordercolor="#FFFF00" noresize title="top" scrolling="no">
<frame src="middle.html" frameborder="yes" name="middle" bordercolor="#FF0000" noresize title="left">
<frame src="bottom.html" frameborder="yes" name="bottom" bordercolor="#FFFF00" noresize title="bottom" scrolling="no">

</frameset>

<noframes></noframes>
<script>
var height = document.body.clientHeight || document.documentElement.clientHeight;
var iframeset = document.getElementById('frameset');

iframeset.rows = '126,' + (height - 126) + ',90';
alert(iframeset.rows)
</script>
</body>
</html>

87,989

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧