2010-11-23 94 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"; };