<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.non_used{
background-color:red;
text-align: center;
width: 300px;
font-size:100px;
}
.used{
background-color: yellow;
text-align: center;
width: 300px;
font-size:100px;
color: red;
}
</style>
<script type="text/javascript">
var i = 0;
var block = document.getElementsByTagName("div");
function test(i){
if(block[i].classList.contains("non_used")){
block[i].classList.remove("non_used");
block[i].classList.add("used");
}else{
block[i].classList.remove("used");
block[i].classList.add("non_used");
};
}
</script>
</head>
<div class="non_used" onclick="test(0)">000</div>
<div class="non_used" onclick="test(1)">111</div>
<div class="non_used" onclick="test(2)">222</div>
<div class="used" onclick="test(3)">333</div>