<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
li{
list-style: none;
width: 113px;
height: 140px;
background-image: url(img/normal.png);
float: left;
margin-right: 20px;
}
</style>
<script>
window.οnlοad=function()
{
var ali=document.getElementsByTagName("li");
//var off=true;只能控制一组
for(var i=0;i<=ali.length;i++)
{
ali[i].off=true;
ali[i].οnclick=function()
{
if(this.off)
{
this.style.background="url(img/normal.png)";
this.off=false;
}
else
{
this.style.background="url(img/active.png)";
this.off=true;
}
}
}
}
</script>
</head>
<body>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>