我是用的repeater绑定的数据,想要实现光棒效果..
可是却不知道怎么做,还请高手们指教!!!!
可是却不知道怎么做,还请高手们指教!!!!
解决方案 »
- 在子页中如何 获得模板页 中的控件?
- 如何设计一个扩展性强的OA,可以自由插拔组件?
- 如何让ASP.NET 应用程序的进程具有连接至 SQL Server 数据库的权限??
- 两个DropDownList的联动
- 北大青鸟的学子们争口气,让我们展翅翱翔。和那些大学生,研究室试比高,哪怕输了也随败犹荣,至少我们不像他们说的那样无能!!!!!!
- 做了三个月,终于完成了,大家帮我看看怎么样,提点意见,顺便散分
- 正则表达式如何匹配字符串最后一位是空或者是"/"
- 关键字输入问题
- 高手们asp.net项目管理工具有哪些呀
- 如何判断session是否有需要的内容?
- “会话状态已创建一个会话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