asp.net中的高亮显示出了问题 高手帮忙解决一下 有机会请你喝茶 gridview 中高亮显示 把原来的样式覆盖了呀,当我把鼠标移上去的时候是变了颜色但是鼠标移走变成我设置的颜色 我希望只是鼠标以上去就变色移走的话还是原来的颜色怎么搞呀!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 分别设置onmouseover和onmouseout两种状态时的两种颜色 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#cccccc'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); } } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#cccccc'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); } } 2楼的可行还可以用JSwindow.onload=function () { var otr=document.body.getElementsByTagName("tr"); for(var i=1;i<otr.length;i++) { otr[i].onmouseover=function () { this.style.backgroundColor="#c6f3b5"; } otr[i].onmouseout=function () { this.style.backgroundColor="#FFF"; } } } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#cccccc'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); } } e.Row.Attributes.Add("onmouseover", "OverColor(tr" + e.Row.RowIndex.ToString() + ")"); e.Row.Attributes.Add("onmouseout", "OutColor(tr" + e.Row.RowIndex.ToString() + ")");function OverColor(obj,tr) { currentcolor=tr.style.backgroundColor } function OutColor(tr) { tr.style.backgroundColor=currentcolor; } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=''"); e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#507CD1'"); e.Row.Attributes["style"] = "Cursor:hand"; } } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=''"); e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#507CD1'"); } } jQuery$(function(){ var currentColor; $("table tr:has(td)").mouseover(function(){ currentColor = $(this).css('background-color'); $(this).css('background-color', '#42BAB6'); }); $("table tr:has(td)").mouseout(function(){ $(this).css('background-color', currentColor); }); }); 求教 跳转问题 页面中有DropDownList和Fckeditor,如法刷新页面 ASP.NET发布网站,数据库链接总是中断 有关用户控件的问题 网站是用2.0 开发的,下面的1.1项目会报错,进来有分 没见到VEA呀 如何实现MSN试的聊天提示框 MENU怎么样邦定数据? DataBinding:“Model.NewsEntity”不包含名为“2014-11-25 19:33:25”的属性 怎样将编译好了的“组件”和“类”进行打包成.dll文件 codesmith 如何选中多个表生成文件 一个简单的sql语句
{
if (e.Row.RowType == DataControlRowType.DataRow) {
e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#cccccc'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");
}
}
{
if (e.Row.RowType == DataControlRowType.DataRow) {
e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#cccccc'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");
}
}
还可以用JS
window.onload=function ()
{
var otr=document.body.getElementsByTagName("tr");
for(var i=1;i<otr.length;i++)
{
otr[i].onmouseover=function ()
{
this.style.backgroundColor="#c6f3b5";
}
otr[i].onmouseout=function ()
{
this.style.backgroundColor="#FFF";
}
}
}
{
if (e.Row.RowType == DataControlRowType.DataRow) {
e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#cccccc'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");
}
}
e.Row.Attributes.Add("onmouseover", "OverColor(tr" + e.Row.RowIndex.ToString() + ")");
e.Row.Attributes.Add("onmouseout", "OutColor(tr" + e.Row.RowIndex.ToString() + ")");
function OverColor(obj,tr)
{
currentcolor=tr.style.backgroundColor
}
function OutColor(tr)
{
tr.style.backgroundColor=currentcolor;
}
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=''");
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#507CD1'");
e.Row.Attributes["style"] = "Cursor:hand";
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{ if (e.Row.RowType == DataControlRowType.DataRow)
{ e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=''"); e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#507CD1'");
} }
var currentColor;
$("table tr:has(td)").mouseover(function(){
currentColor = $(this).css('background-color');
$(this).css('background-color', '#42BAB6');
});
$("table tr:has(td)").mouseout(function(){
$(this).css('background-color', currentColor);
});
});