asp.net 在表格中,怎么让鼠标经过改变背景颜色?
2个回答
展开全部
在gridview控件的rowdatabound事件中加入下面代码
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) //高亮显示鼠标所在行
{
if (e.Row .RowType ==DataControlRowType .DataRow)
{
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;");
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) //高亮显示鼠标所在行
{
if (e.Row .RowType ==DataControlRowType .DataRow)
{
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;");
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询