当前位置:Gxlcms > asp.net > repeater隔行换色与鼠标停留在上面达到变色效果

repeater隔行换色与鼠标停留在上面达到变色效果

时间:2021-07-01 10:21:17 帮助过:48人阅读

代码如下:

<tr align="center" class="list_L01" style='background-color: <%#(Container.ItemIndex%2==0)?"#FFFFF;":"#fcf3f4"%>' onmouseover="change_colorOver(this)" onmouseout="change_colorOut(this)"></tr>

代码如下:

<input type="hidden" id="colorName" value="1" /> //隐藏域定义
function change_colorOver(e) {
var oldColor = e.style.backgroundColor;
document.getElementById("colorName").value = oldColor;
e.style.backgroundColor = "#b9bace";
}
function change_colorOut(e) {
e.style.backgroundColor = document.getElementById("colorName").value;
}

人气教程排行