HTML DOM cols นามสาขา

การระบุและวิธีใช้

cols นามสาขาสามารถตั้งค่าหรือกลับค่าจำนวนและขนาดของคอลัมน์ใน frameset

รายการพิกัดหรือเปอร์เซ็นต์ที่แบ่งตัวด้วยคมานิยามชี้จำนวนและความกว้างของคอลัมน์

วิธีการใช้

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

ตัวอย่าง

ในตัวอย่างของเรา ก่อนหน้านี้จะสร้างเอกสาร HTML ที่มี frameset ที่มี两列

<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="Change column size" />
<input type="button" onclick="restoreCols()"
value="Restore column size" />
</body>
</html>