<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title></title>
<style>
li{
List-style-type:none;
width:114px;
height:140px;
Background:url ('./normal.png ');
margin-right:20px;
Float:left;
}
</style>
<script>
Window.onload = function () {
var aLi = document.getelementsbytagname (' li '); Get the LI element
var onOff = true; Define a variable
for (Var i=0;i<ali.length;i++) {
Ali[i].onoff = true;
Ali[i].onclickr = function () {
if (ONOFF) {//Judgment
This. Style.background = "url (./active.png)";//this representative Ali[i]
onOff = false; changing variables
}else{
this.style.background = "url (./normal.png)";
onOff = true;
}
};
}
};
</script>
<body>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
Click the button to change more than one image