효과 데모 코드:
]
핵심 코드:
코드는 다음과 같습니다.
function showtable(){
var color1 = "rgb(234,240,255)";
var color2 = "rgb(255,255,255)";
var bgColor = "rgb(255,255,193)"
var trs = document.getElementById("datatable) ").getElementsByTagName("tr") ;
for (var i=0;iif (i%2==0) {
trs[i ].style.BackgroundColor=color1;
trs[i].onmouseover = function(){
this.style.BackgroundColor = bgColor;
}
trs[i].onmouseout = function() {
this.style.BackgroundColor = color1;
}
} else {
trs[i].style.BackgroundColor=color2
trs[i].onmouseover = function(){
this.style.BackgroundColor = bgColor;
}
trs[i].onmouseout = function(){
this.style.BackgroundColor = color2; >}
}