Zyuzka,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
function test() {
var divs;
for (var j = 0; j < 6; j++) {
divs = document.getElementById('a' + j);
divs.onclick = function() {
var color = "linear-gradient(to right, blue, blue)"
for (var j = 0; j < 6; j++) {
divs = document.getElementById('a' + j);
divs.style.backgroundImage = divs == this ? "linear-gradient(to right, blue, white)" : color;
if (divs == this) color = '';
}
}
}
}
</script>
</head>
<body onload="test()">
<div id="a0">1</div>
<div id="a1">2</div>
<div id="a2">3</div>
<div id="a3">4</div>
<div id="a4">5</div>
<div id="a5">6</div>
</body>
</html>