innerHTML causes runtime error

C

Camet

function showRowInfo()
{
// grabs the row that the user clicks on,
var rownum = this.rowIndex;

var newRow = document.getElementById('thisTableId');

//reports: that the row in the table the user clicked on has
// <TD>blah</TD><TD>rebot</TD>

alert(document.getElementById('thisTableId').rows[(rownum)].innerHTML)

for (var i = 0; i < 3; h++)
{
//rowCode contains the cells that I want to be created in
// the row, generated earlier. example: <TD class=content
// align=center>&rarr;</TD><TD class=largeContent
// align=right>Hello</TD>
var info = rowInfoArray[rownum-1].rowCode;

alert(info); //reports: <TD class=content
// align=center>&rarr</TD><TD
// class=largeContent align=right>Hello</TD> ** which is
// as it should be

newRow.insertRow((rownum+1+i)) // add a row underneath the row
// that was clicked on and under any new rows that have
// already been created

alert (newRow.rows[(rownum+1+i)].innerHTML);
// reports: blank, the row is empty

// attempting to add the above rowCode info stored in the
// variable info as the innerHTML
newRow.rows[(rownum+1+i)].innerHTML=info;

// Testing to see if the row has successly changed. BUT the html
// does not get to this line, it crashes on the above line
alert(newRow.rows [(rownum+1+i)].innerHTML);
}


// this method makes the rows of the table listened to when clicked.
// It is called upon after the table is made.
function addRowListeners()
{
var table = document.getElementById('thisTable");

if(table)
{
rows = table.rows;
var n = rows.length;

// Add the listener to each row in the table.
for(var i = 1; i < n; ++i)
{
// when the row is clicked upon, call this message
rows.onclick = showRowInfo;
}
}
}

*******************
The targeted system is IE 6.

Any suggestions are welcome. I have been scratching my head trying to
figure what is wrong

Camet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top