<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>123</title>
<script>
window.onload=function(){
var oul=document.getElementById("ul");
var a = oul.getElementsByTagName("li");
for(var i =0;i<a.length;i++)
{
if(a[i].className=='box')
{
a[i].style.background='red';
}
}
}
</script>
</head>
<body>
<ul id="ul">
<li class="box"></li>
<li class="box"></li>
<li></li>
<li></li>
<li class="box"></li>
<li></li>
</ul>
</body>
</html>
牛奶老哥哥
慕桂英0370477
慕桂英0370477