调用的JavaScript:
<script type="text/javascript">
/*高亮显示鼠标所在行*/
function mouseovertd2(o)
{
dff=o.style.backgroundColor;
o.style.backgroundColor="#EAEBF1";
}
function mouseouttd2(o)
{
o.style.backgroundColor=dff;
}
</script>
/*高亮显示鼠标所在行*/
function mouseovertd2(o)
{
dff=o.style.backgroundColor;
o.style.backgroundColor="#EAEBF1";
}
function mouseouttd2(o)
{
o.style.backgroundColor=dff;
}
</script>
GridView中的DataBound事件代码:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "mouseovertd2(this)");
e.Row.Attributes.Add("onmouseout", "mouseouttd2(this)");
e.Row.Attributes["style"] = "Cursor:hand";
}
}
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "mouseovertd2(this)");
e.Row.Attributes.Add("onmouseout", "mouseouttd2(this)");
e.Row.Attributes["style"] = "Cursor:hand";
}
}