You are here: Reference > JavaScript > client-side > HTML DOM > properties > cols (frameset)

cols property (frameset)

Browser support:
Sets or retrieves the widths of the columns within a frameset element. All frame elements in the same column has the same width as the column.
The cols property not only specifies the width of the columns, but also specifies the count of the columns in the frameset. The count of the comma-separated items in the value of the cols property defines the count of the columns.
The rows property is similar to the cols property, but it defines the height and the count of the rows in the frameset.
The order of the frames is left-to-right, and top-to-bottom.


You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: cols

Possible values:

A comma-separated list that specifies or retrieves the width of the columns in the current frameset.
The width can be one of the following values:
width in pixels
Integer with or without a px (pixel) designator.
Integer higher or equal to 0 , with a % designator. The value is a percentage of the width of the frameset.
Integer, followed by a '*' sign. Defines the width as a relative value. If only the '*' sign is defined, it is equivalent to the value of '1*'. After the pixel and percentage values are calculated, the rest of the space is divided among the relative values. For example, if there are two relative values: (2*, 3*) and the remaining space is 250px, than the value of '2*' represents a 100px width column, the value of '3*' represents a 150px width column.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the cols attribute:
<frameset rows="*" cols="200, *" border="10px" bordercolor="red">
    <frame src="topFrame.htm" name="topFrame" scrolling="No"/>
    <frame src="mainFrame.htm" name="mainFrame"/>
Did you find this example helpful? yes no

Example HTML code 2:

You can get the cols property of the frameset from one of its frames. The code below shows how to implement it.
<script type="text/javascript">
    function GetFramesetCols () {
        var frameSet = window.frameElement.parentNode;
        return frameSet.cols;
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content