Frameset colsプロパティ
Frameset オブジェクト
定義と使用法
cols プロパティは、フレームセット内の列の数とサイズを設定または返します。
カンマで区切られたピクセルまたはパーセントのリストが、列の数と幅を定義します。
構文
framesetObject.cols=values
cols プロパティには、以下の1つ以上の値を指定できます:
| 值 | 説明 |
|---|---|
| pixels | 列のサイズをピクセル単位で指定します(例:"100px" または "100") |
| % | 列のサイズをパーセント単位で指定します(例:"50%") |
| * | 残りの利用可能な列スペース |
ブラウザサポート
![]()
すべての主要ブラウザが cols プロパティをサポートしています。
例
この例では、まず2つの列を持つフレームセットを含むHTMLドキュメントを作成します。各列はブラウザウィンドウの50%に設定されます:
<html>
<frameset id="main" cols="50%,50%">
<frame src="frame_cols.htm.html">
<frame src="frame_a.htm.html">
</frameset>
</html>
<frameset id="main" cols="50%,50%">
<frame src="frame_cols.htm.html">
<frame src="frame_a.htm.html">
</frameset>
</html>
"frame_cols.htm" のソースコードは以下の通りです:
例
<html>
<head>
<script>
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>
<head>
<script>
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>
試してみる »
Frameset オブジェクト その他の拡張