单元格颜色渐变的GridView

代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>单元格颜色渐变的GridView</title> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <style type="text/css"> <!-- body{margin-top:0; margin-left:0; margin-right:0; margin-bottom:0} .stylemenu{ font-family:Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold;} .stylemenu01{ font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold;} .styletitle{ font-family:Arial, Helvetica, sans-serif; font-size:16px; font-weight:bold; color:#000} .styletop{ font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#CCCCCC} .stylebottom{ font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#000} .stylebottomred{ font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#D20000} .styletable{ font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000} .styletabletitle{ font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:13px; color:#000} .stylelegend{ font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:14px; color:#666} .name{ font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:16px; color:#FFF} A.black:link,A.black:visited ,A.black:active {color: #000;TEXT-DECORATION: none} A.black:hover {color: #666;text-decoration : none; position : relative;} A.whitetop:link,A.whitetop:visited ,A.whitetop:active {color:#FFF;TEXT-DECORATION: none} A.whitetop:hover {color:#CCC;text-decoration : none; position : relative;} A.graymenu:link,A.graymenu:visited ,A.graymenu:active {color:#999;TEXT-DECORATION: none} A.graymenu:hover {color:#333;text-decoration : none; position : relative;} A.blacktable:link,A.blacktable:visited ,A.blacktable:active {color: #000;TEXT-DECORATION: none} A.blacktable:hover {color: #666;text-decoration : none; position : relative;} fieldset { padding:10px; margin-top:5px; border:1px solid #999999; background:#fff; } fieldset legend { color:#999999; font-weight:bold; padding:3px 20px 3px 20px; border:1px solid #999999; background:#fff; } .button { color: #000000; font-family: Arial, Hevlvetica, sans-serif; text-align: center; font-size: 12px; border: 3px double #cccccc; width: auto; background: #ffffff; padding: 1px 5px 1px 5px; line-height: 16px !important; line-height: 14px; height: 24px !important; height: 22px; margin: 1px; cursor: pointer; } .go { color: #000000; font-family: Arial, Hevlvetica, sans-serif; text-align: center; font-size: 10px; font-weight:bold; border: 1px double #999; width: auto; background: #ffffff; line-height: 14px !important; line-height: 12px; height: 16px !important; height: 14px; margin: 1px; cursor: pointer; } .sffocus {/*----for IE----*/ background: #EEF2FF; border: 1px solid #1D95C7; } textarea:focus, input:focus {/*----for firefox......----*/ background: #EEF2FF; border: 1px solid #1D95C7; } input,textarea{ border: 1px solid #999; margin: 0px 0px; } textarea{ padding: 2px; } .checkbox{ border:0} .page{ font-weight:bold; color:#FF0000} #GridView1 tr { background-color: expression(this.sectionRowIndex == 0 ? "#A5A8C2" : ((this.sectionRowIndex % 2 == 0) ? "#F5F5F8" : "#FFFFFF")); color: expression(this.sectionRowIndex == 0 ? "#FFFFFF" : ""); font-weight: expression(this.sectionRowIndex == 0 ? "BOLD" : ""); TableSelect: expression(this.sectionRowIndex == 0 ? "" : ( onmouseover = function() { this.style.backgroundColor = (this.style.backgroundColor != "#eef2ff" ? "#eef2ff" : (this.sectionRowIndex == 0 ? "#A5A8C2" : (this.sectionRowIndex % 2 == 0 ? "#F5F5F8" : "#FFFFFF"))) }, onmouseout = function() { this.style.backgroundColor = (this.style.backgroundColor != "#eef2ff" ? "#eef2ff" : (this.sectionRowIndex == 0 ? "#A5A8C2" : (this.sectionRowIndex % 2 == 0 ? "#F5F5F8" : "#FFFFFF"))) } ) ) } #GridView1 td { background-color:expression(this.cellIndex == 0 ? (this.parentElement.sectionRowIndex == 0 ? "#A5A8C2" : "#A5A8C2") : null) } --> </style> </head> <body> <table cellspacing="0" cellpadding="3" rules="rows" border="1" id="GridView1" style="background-color:White;border-color:#CCDDEF;border-width:1px;border-style:None;border-collapse:collapse;"> <tr style="color:Black;background-color:#A5A8C2;font-weight:bold;white-space:nowrap;"> <th scope="col">Operation</th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$GroupId')" style="color:Black;">Group ID</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$Name')" style="color:Black;">Group Name</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$Description')" style="color:Black;">Comment</a></th> </tr><tr class="styletable"> <td> <span class="stylebottom"> <a id="GridView1_ctl02_btnEdit" class="blacktable" href="javascript:__doPostBack('GridView1$ctl02$btnEdit','')">Edit</a> | <a class="blacktable" οnclick="javascript:return confirm('Are you sure to delete the group?');" href="?Act=Del&GroupID=1" title="Delete">Delete</a> | <a class="blacktable" href="Admin_GroupRelation.aspx?GroupID=1&GroupName=CompanyAdmin" title="Relation">Relation</a> </span> </td><td>1</td><td>CompanyAdmin</td><td>Common Users</td> </tr><tr class="styletable" style="background-color:#F5F5F8;"> <td> <span class="stylebottom"> <a id="GridView1_ctl03_btnEdit" class="blacktable" href="javascript:__doPostBack('GridView1$ctl03$btnEdit','')">Edit</a> | <a class="blacktable" οnclick="javascript:return confirm('Are you sure to delete the group?');" href="?Act=Del&GroupID=2" title="Delete">Delete</a> | <a class="blacktable" href="Admin_GroupRelation.aspx?GroupID=2&GroupName=Users" title="Relation">Relation</a> </span> </td><td>2</td><td>Users</td><td>Company Administrator</td> </tr><tr class="styletable"> <td> <span class="stylebottom"> <a id="GridView1_ctl04_btnEdit" class="blacktable" href="javascript:__doPostBack('GridView1$ctl04$btnEdit','')">Edit</a> | <a class="blacktable" οnclick="javascript:return confirm('Are you sure to delete the group?');" href="?Act=Del&GroupID=3" title="Delete">Delete</a> | <a class="blacktable" href="Admin_GroupRelation.aspx?GroupID=3&GroupName=1" title="Relation">Relation</a> </span> </td><td>3</td><td>1</td><td>1</td> </tr><tr class="styletable" style="background-color:#F5F5F8;"> <td> <span class="stylebottom"> <a id="GridView1_ctl05_btnEdit" class="blacktable" href="javascript:__doPostBack('GridView1$ctl05$btnEdit','')">Edit</a> | <a class="blacktable" οnclick="javascript:return confirm('Are you sure to delete the group?');" href="?Act=Del&GroupID=4" title="Delete">Delete</a> | <a class="blacktable" href="Admin_GroupRelation.aspx?GroupID=4&GroupName=2" title="Relation">Relation</a> </span> </td><td>4</td><td>2</td><td>&nbsp;</td> </tr><tr class="styletable"> <td> <span class="stylebottom"> <a id="GridView1_ctl06_btnEdit" class="blacktable" href="javascript:__doPostBack('GridView1$ctl06$btnEdit','')">Edit</a> | <a class="blacktable" οnclick="javascript:return confirm('Are you sure to delete the group?');" href="?Act=Del&GroupID=5" title="Delete">Delete</a> | <a class="blacktable" href="Admin_GroupRelation.aspx?GroupID=5&GroupName=3" title="Relation">Relation</a> </span> </td><td>5</td><td>3</td><td>&nbsp;</td> </tr><tr class="styletable" style="background-color:#F5F5F8;"> <td> <span class="stylebottom"> <a id="GridView1_ctl07_btnEdit" class="blacktable" href="javascript:__doPostBack('GridView1$ctl07$btnEdit','')">Edit</a> | <a class="blacktable" οnclick="javascript:return confirm('Are you sure to delete the group?');" href="?Act=Del&GroupID=6" title="Delete">Delete</a> | <a class="blacktable" href="Admin_GroupRelation.aspx?GroupID=6&GroupName=6" title="Relation">Relation</a> </span> </td><td>6</td><td>6</td><td>&nbsp;</td> </tr><tr class="styletable"> <td> <span class="stylebottom"> <a id="GridView1_ctl08_btnEdit" class="blacktable" href="javascript:__doPostBack('GridView1$ctl08$btnEdit','')">Edit</a> | <a class="blacktable" οnclick="javascript:return confirm('Are you sure to delete the group?');" href="?Act=Del&GroupID=7" title="Delete">Delete</a> | <a class="blacktable" href="Admin_GroupRelation.aspx?GroupID=7&GroupName=4" title="Relation">Relation</a> </span> </td><td>7</td><td>4</td><td>&nbsp;</td> </tr><tr class="styletable" style="background-color:#F5F5F8;"> <td> <span class="stylebottom"> <a id="GridView1_ctl09_btnEdit" class="blacktable" href="javascript:__doPostBack('GridView1$ctl09$btnEdit','')">Edit</a> | <a class="blacktable" οnclick="javascript:return confirm('Are you sure to delete the group?');" href="?Act=Del&GroupID=8" title="Delete">Delete</a> | <a class="blacktable" href="Admin_GroupRelation.aspx?GroupID=8&GroupName=5" title="Relation">Relation</a> </span> </td><td>8</td><td>5</td><td>&nbsp;</td> </tr><tr class="styletable"> <td> <span class="stylebottom"> <a id="GridView1_ctl10_btnEdit" class="blacktable" href="javascript:__doPostBack('GridView1$ctl10$btnEdit','')">Edit</a> | <a class="blacktable" οnclick="javascript:return confirm('Are you sure to delete the group?');" href="?Act=Del&GroupID=9" title="Delete">Delete</a> | <a class="blacktable" href="Admin_GroupRelation.aspx?GroupID=9&GroupName=7" title="Relation">Relation</a> </span> </td><td>9</td><td>7</td><td>&nbsp;</td> </tr><tr class="styletable" style="background-color:#F5F5F8;"> <td> <span class="stylebottom"> <a id="GridView1_ctl11_btnEdit" class="blacktable" href="javascript:__doPostBack('GridView1$ctl11$btnEdit','')">Edit</a> | <a class="blacktable" οnclick="javascript:return confirm('Are you sure to delete the group?');" href="?Act=Del&GroupID=10" title="Delete">Delete</a> | <a class="blacktable" href="Admin_GroupRelation.aspx?GroupID=10&GroupName=8" title="Relation">Relation</a> </span> </td><td>10</td><td>8</td><td>&nbsp;</td> </tr><tr> <td colspan="4"> <span class="stylebottom"> Total:<span style="color:red;font-weight:bold;">11</span> Item(s) Page:<span style="color:red;font-weight:bold;">2</span>/<span style="font-weight:bold;">1</span> Each Page <span style="color:red;font-weight:bold;">10</span> Item(s) <a id="GridView1_ctl13_First" class="blacktable" href="javascript:__doPostBack('GridView1$ctl13$First','')">[First]</a> <a id="GridView1_ctl13_Prev" class="blacktable" href="javascript:__doPostBack('GridView1$ctl13$Prev','')">[Prev]</a> <a id="GridView1_ctl13_Next" class="blacktable" href="javascript:__doPostBack('GridView1$ctl13$Next','')">[Next]</a> <a id="GridView1_ctl13_Last" class="blacktable" href="javascript:__doPostBack('GridView1$ctl13$Last','')">[Last]</a> Goto Page <input id="GoToPage" name="GoToPage" style="height:10px;width:30px;font-size:smaller; font-weight: bold; color: red; text-align: center" class="page" value="1" maxlength="9" /> <input type="submit" name="GridView1$ctl13$Go" value=" Go " id="GridView1_ctl13_Go" class="go" /> </span> </td> </tr> </table> </body> </html>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]   

转载于:https://www.cnblogs.com/Dicky/archive/2006/12/30/607988.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值