Repeater控件绑定了数据之后,怎么改变前面三行数据的颜色?不是文本颜色,是行颜色,在线等解答
repearter控件里面放的Table,我想数据的前3行有颜色,后台有个repearter的ItemDataBound事件,是不是可以在这里面判断是否为前3行?然后改样...
repearter控件里面放的Table,我想数据的前3行有颜色,后台有个repearter的ItemDataBound事件,是不是可以在这里面判断是否为前3行?然后改样式?
展开
展开全部
<td style="background-color:<%# Eval("id")>3 ? red:black%>;">
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我这里有一段光棒效果的代码(在绑定行tr里面调用),你参考参考:
//实现光棒效果js
var highlightcolor = '#c1ebff';
var clickcolor = '#51b2f6';
function changeto() {
source = event.srcElement;
if (source.tagName == "TR" || source.tagName == "TABLE")
return;
while (source.tagName != "TD")
source = source.parentElement;
source = source.parentElement;
cs = source.children;
if (cs[1].style.backgroundColor != highlightcolor && source.id != "nc" && cs[1].style.backgroundColor != clickcolor)
for (i = 0; i < cs.length; i++) {
cs[i].style.backgroundColor = highlightcolor;
}
}
function changeback() {
if (event.fromElement.contains(event.toElement) || source.contains(event.toElement) || source.id == "nc")
return
if (event.toElement != source && cs[1].style.backgroundColor != clickcolor)
for (i = 0; i < cs.length; i++) {
cs[i].style.backgroundColor = "";
}
}
调用:
<tr onmouseover="changeto()" onmouseout="changeback()">
<td>
<%# Eval("Exam_QuestionTitle")%>
</td>
........
//实现光棒效果js
var highlightcolor = '#c1ebff';
var clickcolor = '#51b2f6';
function changeto() {
source = event.srcElement;
if (source.tagName == "TR" || source.tagName == "TABLE")
return;
while (source.tagName != "TD")
source = source.parentElement;
source = source.parentElement;
cs = source.children;
if (cs[1].style.backgroundColor != highlightcolor && source.id != "nc" && cs[1].style.backgroundColor != clickcolor)
for (i = 0; i < cs.length; i++) {
cs[i].style.backgroundColor = highlightcolor;
}
}
function changeback() {
if (event.fromElement.contains(event.toElement) || source.contains(event.toElement) || source.id == "nc")
return
if (event.toElement != source && cs[1].style.backgroundColor != clickcolor)
for (i = 0; i < cs.length; i++) {
cs[i].style.backgroundColor = "";
}
}
调用:
<tr onmouseover="changeto()" onmouseout="changeback()">
<td>
<%# Eval("Exam_QuestionTitle")%>
</td>
........
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询