用JS的方法使用列表LI制作的隔行换色
用JS的方法搞一个隔行换色,但这就不是表格了,而是列表LI
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style>
body{
font-size:12px;
line-height:21px;
color:#3E352F;
}
ul{
width:200px;
list-style:none;
}
.one{
background:#CDC194;
}
.two{
background:#DDDABF;
}
</style>
<script>
function set(){
var obj=document.getElementsByTagName("li");
var num=obj.length
for(var i=0;i<num;i ){
if(i%2==0){
obj
.className="one";
}else{
obj.className="two";
}
}
}
</script>
</head>
<body >
<ul>
<li>1.假字以数十字为基础假字数…</li>
<li>2.假字以数十字为基础假字数…</li>
<li>3.假字以数十字为基础假字数…</li>
<li>4.假字以数十字为基础假字数…</li>
<li>5.假字以数十字为基础假字数…</li>
</ul>
</body>
</html>
| 感谢原创者的辛勤劳动,希望对您有所帮助,转载请注明原出处。 |