HTML DOM cols 属性

定义和用法

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

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

语法

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

实例

在我们的例子中,首先将创建包含带有两个列的框架集的 HTML 文档。每列设置为浏览器窗口的 50%:

<html>
<frameset cols="50%,50%">
  <frame src="frame_cols.htm">
  <frame src="frame_a.htm">
</frameset>
</html>

HTML 문서 "frame_cols.htm"은 첫 번째 열에, HTML 문서 "frame_a.htm"은 두 번째 열에 삽입되었습니다.

아래는 "frame_cols.htm"의 소스 코드입니다:

<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="컬럼 크기 변경" />
<input type="button" onclick="restoreCols()"/>
value="컬럼 크기 복구" />
</body>
</html>