程序员的知识教程库

网站首页 > 教程分享 正文

JavaScript Frameset对象(web中frameset)

henian88 2024-08-27 15:46:22 教程分享 5 ℃ 0 评论

Frameset 对象

Frameset 对象代表 HTML 框架集。

一般而言,在框架集中访问Frameset对象的属性可通过如下方法:

document.all.FramesetID.property

document.getElementById(FramesetID).property 推荐使用

在框架集的某个框架内,可通过如下访问该Frameset对象

parent.document.all.FramesetID.property

parent.document.getElementById(FramesetID).property

Frameset 对象的属性

cols 设置或返回框架集中列的数目。

id 设置或返回框架集的 id。

rows 设置或返回框架集中行的数目。

cols 属性可设置或返回框架集中列的数目和尺寸。

由逗号分割的像素或百分比列表定义了列的数目和宽度:

framesetObject.cols=col1,col2,col3....

<html>
<head>
<script type="text/javascript">
function changeCols()
{
		parent.document.getElementById("main").cols="30%,70%"
}
function restoreCols()
{
		parent.document.getElementById("main").cols="50%,50%"
}
</script>
</head>
<body>
<input type="button" onclick="changeCols()" value="Change column size" />
<input type="button" onclick="restoreCols()" value="Restore column size" />
</body>
</html>

rows 属性可设置或返回框架中行的数目和尺寸。

由逗号分割的像素或百分比列表定义了列的数目和高度:

framesetObject.rows=row1,row2,row3....

<html>
<head>
<script type="text/javascript">
function changeRows()
{
		parent.document.getElementById("main").rows="30%,70%"
}
function restoreRows()
{
		parent.document.getElementById("main").rows="50%,50%"
}
</script>
</head>
<body>
<form>
<input type="button" onclick="changeRows()" value="Change row size" />
<input type="button" onclick="restoreRows()" value="Restore row size" />
</form>
</body>
</html>

标准属性

className 设置或返回元素的 class 属性。

dir 设置或返回文本的方向。

lang 设置或返回元素的语言代码。

title 设置或返回元素的 title 属性。

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表