| Author |
Object Required error in Javascript.
|
Anil dhingra
Greenhorn
Joined: Oct 01, 2009
Posts: 8
|
|
Hi All,
My code looks like below:
function OnHTMLTable1_ClickLink ( ) {
var TableDiv = document.getElementById("HTMLTable1");
var oRows = document.getElementById("HTMLTable1").getElementsByTagName('tr');
var iRowCount = oRows.length;
for(k=1; k<=iRowCount; k++)
{
if(document.getElementById("list"+o+k).selectedIndex == 0)
{
document.getElementById("list"+o+k).selectedIndex = 1;
document.getElementById("list"+o+k).options[1].style.backgroundColor = "green";
}
}
when I am trying to run this code it opens a new browser page and throwing a error "Object Required".I think it is not finding the object "HTMLTable1" and reading it as a null value due to which throwing this error.Please suggest me the way to handle this error in javascript.
Thanks,
Anil
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56150
|
|
|
Is there an element with an id of HTMLTable1 in the DOM? Don;t you think this is important information to include in your post?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Anil dhingra
Greenhorn
Joined: Oct 01, 2009
Posts: 8
|
|
Hi,
HTMLTable1 is the object which i am paasing to get the no. of rows in the HTML table.That row count is getting used in the code further for coloring the cells.Please let me know if you require any further input regarding this.
Thanks.
|
 |
 |
|
|
subject: Object Required error in Javascript.
|
|
|