<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="text"><br>
<input type="text"><br>
<input type="text"><br>
<input type="text"><br>
<input type="text"><br>
<input type="text"><br>
<input type="text"><br>
<script>
var tets = document.getElementsByTagName("input");
for(var i = 0; i < tets.length; i++){
tets[i].onfocus = function(){
for(var j = 0; j < tets.length; j++){
tets[j].style.backgroundColor = "";
}
this.style.backgroundColor = "yellow";
};
};
</script>
</body>
</html>