亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

asp.net ListView交替背景顏色實(shí)現(xiàn)代碼

 更新時(shí)間:2010年02月25日 17:00:27   作者:  
在asp.net中ListView的交替背景顏色實(shí)現(xiàn),GridView的處理得較多,ListView可以這樣實(shí)現(xiàn)。
只一行代碼:
復(fù)制代碼 代碼如下:

<tr style="<%# (Container.DisplayIndex%2==0)?"background-color:white;":"background-color:#EEEEEE;" %>">

另外還有直接用js處理整個(gè)頁(yè)面中所有tr的交替色:
復(fù)制代碼 代碼如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>全選并改變TR顏色</title>
<script language="JavaScript" type="text/javascript" for="checkbox" event="onclick"><!--
tr_bgcolor(this);
// --></script>
<script language="JavaScript" type="text/javascript"><!--
function tr_bgcolor(c){
var tr = c.parentNode.parentNode;
tr.rowIndex % 2 == 0 ? tr.style.backgroundColor = c.checked ? '#add6a6' : '#eee' : tr.style.backgroundColor = c.checked ? '#add6d6' : '';
}
function selall(obj){
for (var i=0; i<obj.form.elements.length; i++)
if (obj.form.elements[i].type == 'checkbox' && obj.form.elements[i] != obj){
obj.form.elements[i].checked = obj.checked;
tr_bgcolor(obj.form.elements[i]);
}
}
// --></script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#888888">
<tr><td><input name="selectall" type="checkbox" value="全選" onclick="selall(this)" /></td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr style="background-color:#eee;" style="background-color:#eee;"><td width="6%"><input type="checkbox" name="checkbox" /></td><td width="94%">***********************</td></tr>
<tr><td><input type="checkbox" name="checkbox" /></td><td>***********************</td></tr>
<tr style="background-color:#eee" style="background-color:#eee"><td><input type="checkbox" name="checkbox" /></td><td>***********************</td></tr>
<tr><td><input type="checkbox" name="checkbox" /></td><td>***********************</td></tr>
<tr style="background-color:#eee" style="background-color:#eee"><td><input type="checkbox" name="checkbox" /></td><td>***********************</td></tr>
<tr><td><input type="checkbox" name="checkbox" /></td><td>***********************</td></tr>
<tr style="background-color:#eee" style="background-color:#eee"><td><input type="checkbox" name="checkbox" /></td><td>***********************</td></tr>
<tr><td><input type="checkbox" name="checkbox" /></td><td>***********************</td></tr>
<tr style="background-color:#eee" style="background-color:#eee"><td><input type="checkbox" name="checkbox" /></td><td>***********************</td></tr>
</table>
</td></tr>
</table>
</form>
</body>
</html>


復(fù)制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>表格行tr顏色交替</title>
<style><!--
#ab{border-collapse:collapse;width:800px;margin:10px auto;}
#ab td{border:1px solid #ccc;border-top:none;padding:4px;text-align:center;}
.tr1{background-color:#eee;color:red;}
.tr2 {background-color:#ccc;color:blue;}
--></style><style bogus="1">#ab{border-collapse:collapse;width:800px;margin:10px auto;}
#ab td{border:1px solid #ccc;border-top:none;padding:4px;text-align:center;}
.tr1{background-color:#eee;color:red;}
.tr2 {background-color:#ccc;color:blue;}</style>
<script type="text/javascript"><!--
function colortd(ob) {
obob=ob.rows;
for(var i=0;i<ob.length;i++) {
if(i%2) ob(i).className="tr1";
else ob(i).className="tr2";
}
}
// --></script>
</head>
<body onload="colortd(ab)">
<table id="ab">
<tr><td>hang------------1</td></tr>
<tr><td>hang------------2</td></tr>
<tr><td>hang------------3</td></tr>
<tr><td>hang------------4</td></tr>
</table>
</body>
</html>

相關(guān)文章

  • ASP.Net Core基于EF6、Unitwork、Autofac實(shí)現(xiàn)Repository模式

    ASP.Net Core基于EF6、Unitwork、Autofac實(shí)現(xiàn)Repository模式

    這篇文章介紹了ASP.Net Core基于EF6、Unitwork、Autofac實(shí)現(xiàn)Repository模式的方法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-02-02
  • Visual Studio Debug實(shí)戰(zhàn)教程之基礎(chǔ)入門(mén)

    Visual Studio Debug實(shí)戰(zhàn)教程之基礎(chǔ)入門(mén)

    這篇文章主要給大家介紹了關(guān)于Visual Studio Debug實(shí)戰(zhàn)教程之基礎(chǔ)入門(mén)的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2018-09-09
  • .NET Core3.0創(chuàng)建Worker Services的實(shí)現(xiàn)

    .NET Core3.0創(chuàng)建Worker Services的實(shí)現(xiàn)

    這篇文章主要介紹了.NET Core3.0創(chuàng)建Worker Services的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-10-10
  • ASP.NET?Core自定義中間件的方式詳解

    ASP.NET?Core自定義中間件的方式詳解

    這篇文章主要介紹了ASP.NET?Core自定義中間件的方式,雖然ASP.NET?Core為我們提供了一組豐富的內(nèi)置中間件,但有些時(shí)候我們可能會(huì)需要自定義一些中間件,將其穿插到管道中,以便滿(mǎn)足我們特定業(yè)務(wù)場(chǎng)景的需求,所以本文將介紹3種方式來(lái)滿(mǎn)足自定義中間件的需求
    2022-08-08
  • asp.net 仿騰訊微薄提示 還能輸入*個(gè)字符 的實(shí)現(xiàn)代碼

    asp.net 仿騰訊微薄提示 還能輸入*個(gè)字符 的實(shí)現(xiàn)代碼

    asp.net 仿騰訊微薄提示 還能輸入*個(gè)字符 的實(shí)現(xiàn)代碼,需要的朋友可以參考下。
    2011-10-10
  • XML文件修改節(jié)點(diǎn)屬性值(多種方法)

    XML文件修改節(jié)點(diǎn)屬性值(多種方法)

    有關(guān)XML文件的節(jié)點(diǎn)屬性值修改在使用過(guò)程中經(jīng)常會(huì)遇到過(guò),感興趣的朋友可以參考下本文,希望對(duì)你有所幫助
    2013-04-04
  • .Net Core學(xué)習(xí)教程之在Mvc中簡(jiǎn)單的使用日志組件

    .Net Core學(xué)習(xí)教程之在Mvc中簡(jiǎn)單的使用日志組件

    這篇文章主要給大家介紹了關(guān)于.Net Core學(xué)習(xí)教程之在Mvc中簡(jiǎn)單使用日志組件的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2018-06-06
  • ASP.NET?Core中MVC模式實(shí)現(xiàn)路由二

    ASP.NET?Core中MVC模式實(shí)現(xiàn)路由二

    這篇文章介紹了ASP.NET?Core中MVC模式實(shí)現(xiàn)路由的方法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-04-04
  • IE10下Gridview后臺(tái)設(shè)置行高不起作用解決方法

    IE10下Gridview后臺(tái)設(shè)置行高不起作用解決方法

    GridView1.HeaderStyle.Height=17發(fā)現(xiàn)在IE10 中不起作用,經(jīng)過(guò)反復(fù)測(cè)試修改為e.Row.Cells[0].Height=17即可解決問(wèn)題,有類(lèi)似問(wèn)題的朋友可以參考下哈
    2013-04-04
  • 使用EF CORE遷移數(shù)據(jù)庫(kù)

    使用EF CORE遷移數(shù)據(jù)庫(kù)

    這篇文章介紹了使用EF CORE遷移數(shù)據(jù)庫(kù)的方法,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-05-05

最新評(píng)論