cols attribute | cols property
Sets or retrieves the number of columns in the table.
Syntax
| HTML | <element cols="nColumns" ... > |
|---|---|
| JavaScript | |
Property values
Type: Integer
the number of columns.
Standards information
- Document Object Model (DOM) Level 1 Specification, Section 2.5.5
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
Show: