文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>把Girdview鼠标经过时行变色应用到所有页面

把Girdview鼠标经过时行变色应用到所有页面

时间:2010-10-28  来源:潇客的技术博客

代码
function GridViewColor(GridViewId) {
//获取所有要控制的行
var AllRows = document.getElementById(GridViewId);
if (AllRows != null) {
AllRows
= AllRows.getElementsByTagName("tr");

//设置每一行的背景色和事件,循环从1开始而非0,可以避开表头那一行
for (var i = 1; i < AllRows.length; i++) {
AllRows[i].onmouseout
= function() { this.style.background = "#FFFFFF"; }
}
}
}

引用这段JS,只要在每个页面的Page_Load中注册即可,ctl00_PageBody_gvItems为GirdView的客户端ID 

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "js", "GridViewColor('ctl00_PageBody_gvItems');", true);
排行榜 更多 +
无敌赛车王

无敌赛车王

赛车竞速 下载
多人汽车聚会

多人汽车聚会

赛车竞速 下载
漂移基地

漂移基地

赛车竞速 下载