Column spanProperties

Column 对象参考手册Column Object

Examples

Return the number of columns a <col> element spans (i.e., the value of span):

var x = document.getElementById("myCol").span;

xThe result is:

2

Try it Yourself »

Definition and Usage

The span property is used to set or return the value of the span attribute of a column.

The span property specifies the number of columns a <col> element spans.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the span property.


Syntax

Return the span property:

columnObject.span

Set the formMethod property:

columnObject.span=number

Property Values

Value Description
number Specifies the number of columns the <col> element spans

Technical Details

Return value: A number representing the number of columns


More Examples

Example

Use the span and backgroundColor properties to set the background color of the first two columns to red:

document.getElementById("myCol").span="2";
document.getElementById("myCol").style.backgroundColor="red";

Try it Yourself »


Related Pages

HTML Reference:HTML <col> span Attribute


Column 对象参考手册Column Object

Other Extensions