xxxxxxxxxx
<html>
<meta charset="utf-8">
<title>编程狮(w3cschool.cn)</title>
<head>
<style type="text/css">
table.altrowstable {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #a9c6c9;
border-collapse: collapse;
}
table.altrowstable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #a9c6c9;
}
table.altrowstable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #a9c6c9;
}
.oddrowcolor{
background-color:#d4e3e5;
}
.evenrowcolor{
background-color:#c3dde0;
}
</style>
<script type="text/javascript">
function altRows(id){
if(document.getElementsByTagName){
var table = document.getElementById(id);
var rows = table.getElementsByTagName("tr");
for(i = 0; i < rows.length; i++){
if(i % 2 == 0){
rows[i].className = "evenrowcolor";
}else{
rows[i].className = "oddrowcolor";
}
}
}
}
window.onload=function(){
altRows('alternatecolor');
}
</script>
</head>
<body>
<!-- Table goes in the document BODY -->
<table class="altrowstable" id="alternatecolor">
<tr>
<th>信息标题 1</th><th>信息标题 2</th><th>信息标题 3</th>
</tr>
<tr>
<td>文本 1A</td><td>文本 1B</td><td>文本 1C</td>
</tr>
<tr>
<td>文本 2A</td><td>文本 2B</td><td>文本 2C</td>
</tr>
</tr>
<tr>
<td>文本 3A</td><td>文本 3B</td><td>文本 3C</td>
</tr>
<tr>
<td>文本 4A</td><td>文本 4B</td><td>文本 4C</td>
</tr>
<tr>
<td>文本 5A</td><td>文本 5B</td><td>文本 5C</td>
</tr>
</table>
<!-- The table code can be found here: http://www.textfixer/resources/css-tables.php#css-table03 -->
</body>
</html>