Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
HTML DOM Column object
The HTML DOM Column object is associated with the HTML
| Property | Description |
|---|---|
| Span | To set or return the span attribute value of a column. |
Syntax
Following is the syntax for ?
Creating a Column object ?
var a = document.createElement("COL");
Example
Let us see an example for the column object ?
COL OBJECT
| Fruit | Color | Price |
|---|---|---|
| Mango | Yellow | 100Rs |
| Guava | Green | 50Rs |
Click the below button to get span of the "COL1" col element
Output
This will produce the following output ?

On clicking COLUMN button ?

In the above example we have created a table with 2 rows and 3 columns. The table overall has a style applied to it. Inside the table, we have two
table, th, td {
border: 1px solid blue;
}
#Col1{
background-color:pink;
}
| Fruit | Color | Price |
|---|---|---|
| Mango | Yellow | 100Rs |
| Guava | Green | 50Rs |
We have then created a button COLUMN that will execute the colObj() method when clicked by the user ?
The colObj() method gets the first
function colObj() {
var x = document.getElementById("Col1").span;
document.getElementById("Sample").innerHTML = "The Col1 element has span= "+x;
}
Advertisements
