我是用的repeater绑定的数据,想要实现光棒效果..
可是却不知道怎么做,还请高手们指教!!!!
可是却不知道怎么做,还请高手们指教!!!!
解决方案 »
- 关于正则表达式提取网页上链接的问题
- Repeater间距的问题
- 拼接HTML,在aspx里foreach和cs里Response有区别吗?
- 文本框输入html标签问题
- 能精简写法吗??
- 感觉asp.net 2.0 比 1.1 慢很多
- window.location.href 在xp sp2机上会报脚本错误:没有权限
- 记录日志遇到了iframe的难题
- 初学asp.net!熟悉.net编程环境的朋友来看看!谢谢各位了!
- Castle ActiveRecord 如何代替写 SQL 的where in 查询
- “会话状态已创建一个会话ID,但由于响应已被应用程序刷新而无法保存它”咋回事?
- ASP.net如何做界面设计
protected void GridViewInBox_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{ e.Row.Attributes.Add("OnMouseOver", "this.style.background='#349CF4'"); int s = Convert.ToInt32(e.Row.RowIndex.ToString());
if (s % 2 == 0)
e.Row.Attributes.Add("OnMouseOut", "this.style.background='#EEEEEE'");
else
e.Row.Attributes.Add("OnMouseOut", "this.style.background='#DCDCDC'");
}
}
<ul><li>?
<table>?
?
在.css文件里加个样式不就可以拉吗,
<ItemTemplate>
<tr onmouseover="this.style.backgroundColor='#B9D1F3'" onmouseout="this.style.backgroundColor='#ffffff'">
<td align="center"><%#DataBinder.Eval(Container.DataItem, "字段1")%></td>
<td align="center"><%#DataBinder.Eval(Container.DataItem, "字段2")%></td>
<td align="center"><%#DataBinder.Eval(Container.DataItem, "字段3")%></td>
...
</tr>
</ItemTemplate>
比如在<li>标记里我们可以这么些li{background-color:#000000} --鼠标不移动到li上的的效果
li:hover{background-color:#FFFFFF} --鼠标移动到li上的的效果当然IE7以下{不包含IE}不支持非a标记以外的hover样式,你要用的话要写自定义样式,但我估计没人用IE6之类的了,流行的FF和Opera几个版本都很好的支持
var se;
function myrepeaterse(id)
{
se= id.style.backgroundColor;
id.style.backgroundColor='#FFFFCC';
}
function myrepeaterses(id)
{
id.style.backgroundColor=se;
} <tr style="background-color:#EBEBEB" onmouseover="myrepeaterse(this)" onmouseout="myrepeaterses(this)">
<tr onmouseover="this.style.backgroundColor='#B9D1F3'" onmouseout="this.style.backgroundColor='#ffffff'">
<td align="center"> <%#DataBinder.Eval(Container.DataItem, "字段1")%> </td>
<td align="center"> <%#DataBinder.Eval(Container.DataItem, "字段2")%> </td>
<td align="center"> <%#DataBinder.Eval(Container.DataItem, "字段3")%> </td>
...
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
//更改onmouseover onmouseout 顔色就可以了。
<tr onmouseover="this.style.backgroundColor='#B9D1F3'" onmouseout="this.style.backgroundColor='#ffffff'">
<td align="center"> <%#DataBinder.Eval(Container.DataItem, "字段1")%> </td>
<td align="center"> <%#DataBinder.Eval(Container.DataItem, "字段2")%> </td>
<td align="center"> <%#DataBinder.Eval(Container.DataItem, "字段3")%> </td>
...
</tr>
</AlternatingItemTemplate