< asp:DataGrid id ="DataGrid1" runat ="server" CssClass ="small" ></ asp:DataGrid > 样式 .small {} { font-size: 9pt; weaver:expression(highlight(this))} JavaScript < script language = " javascript " > function highlight(obj) { var hightlightBgColor = '#d6d6d6'; obj.onmouseover = function() { var o = event.srcElement; if(o.tagName=="TD") { with(o.parentElement) { style.backgroundColor = hightlightBgColor; } } } obj.onmouseout = function() { var o = event.srcElement; if(o.tagName=="TD"){o.parentElement.style.backgroundColor = '';} } } </ script > 转载于:https://www.cnblogs.com/timsoft/articles/412265.html