repeater隔行换色与鼠标停留在上面达到变色效果
程序员文章站
2024-03-05 19:02:25
复制代码 代码如下: 复制代码 代码如下:
<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;
}
<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;
}
上一篇: ASP.NET中的URL过滤实现代码