HTML DOM Frameset cols atribut
Definisi dan Penggunaan
cols set properti atau mengembalikan jumlah frame fokus dan ukuran kolom.
Atau persentase dari daftar dipisahkan koma piksel mendefinisikan jumlah kolom dan lebar.
tatabahasa
framesetObject.cols=values
cols atribut mungkin satu atau lebih dari nilai berikut:
值 | 描述 |
---|---|
pixels | 以像素为单位指定列的大小 (如: "100px" 或者 "100") |
% | 以百分比指定列的大小(如:"50%") |
* | 剩余可用的列空间 |
Dukungan Browser
Semua browser utama mendukung cols atribut.
contoh
Dalam contoh kita, pertama membuat frameset dengan dua kolom dari dokumen HTML. Setiap kolom diatur ke 50% dari jendela browser:
<Html>
<Frameset id = "main" cols = "50%, 50%">
<Bingkai src = "frame_cols.htm">
<Bingkai src = "frame_a.htm">
</ Frameset>
</ Html>
<Frameset id = "main" cols = "50%, 50%">
<Bingkai src = "frame_cols.htm">
<Bingkai src = "frame_a.htm">
</ Frameset>
</ Html>
"Frame_cols.htm" Source code adalah sebagai berikut:
contoh
<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>
Coba »
benda frameset