This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object Required error in Javascript.

 
Anil dhingra
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Anil dhingra
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic