all
alt
ch
dir
id
min
rel
top
url
URL
urn
Expand Minimize

cols attribute | cols property

Sets or retrieves the number of columns in the table.

Syntax

HTML<element cols="nColumns" ... >
JavaScript

nColumns = object.cols

 

Property values

Type: Integer

the number of columns.

Standards information

Remarks

Specifying this number can speed up the processing of the table.

Windows Internet Explorer 8 will only render tables up to 1000 columns. To force Windows Internet Explorer 7 rendering mode, see How Do I Take Advantage of the New Features in Internet Explorer 8.

Examples

This example uses the cols attribute and the cols property to set the number of columns in HTML and retrieve the number of columns in script.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/cols.htm


<script type="text/javascript">
function checkCols(oObject)
{
    var iColumns = oObject.cols;
    alert (iColumns);
}
</script>
</head>
<body>
<table id=oTable border cols="3" onclick="checkCols(this)">
<tr><td>Column 1</td><td>Column 2</td><td>Column 3</td></tr>
</table>

See also

table

 

 

Show:
© 2014 Microsoft