Elcid32
07-28-2006, 12:09 AM
Hello Forum:
I have a question regarding the following code snippet:
var rows=tableobj.getElementsByTagName('tr');
for(i=0;i<rows.length;i++){
rows[i].onmouseover = function(){this.style.backgroundColor="gold";}
rows[i].onmouseout = function(){this.style.backgroundColor="#FFFFFF";}
}
This peice of code will not work, no matter what I try. I have verified that there are 20 <tr> tags in tableobj. If I change the code to var rows=tableobj.getElementsByTagName('td'); it works properly (by highligting the individual cells.) What am I doing wrong? Thanks.
Shawn
I have a question regarding the following code snippet:
var rows=tableobj.getElementsByTagName('tr');
for(i=0;i<rows.length;i++){
rows[i].onmouseover = function(){this.style.backgroundColor="gold";}
rows[i].onmouseout = function(){this.style.backgroundColor="#FFFFFF";}
}
This peice of code will not work, no matter what I try. I have verified that there are 20 <tr> tags in tableobj. If I change the code to var rows=tableobj.getElementsByTagName('td'); it works properly (by highligting the individual cells.) What am I doing wrong? Thanks.
Shawn