2010-11-23 97 views
0

我使用此代码行添加到表usign JS:编程使用的onmouseover一个元素与使用appendChild

var tbody = document.getElementById('tableID').getElementsByTagName('tbody')[0]; 

var row = document.createElement("TR"); 
tbody.appendChild(row); 

我想的onmouseover使用上TR,使其改变背景颜色,我怎样才能做到这一点?

回答

0
row.onmouseover = function() { this.style.backgroundColor = "Green"; };