| 
		
			 Цитата: 
		
	 | 
	| 
		как это написать на js?
	 | 
	
<style>
        .sidebar {
            float: left;
            width: 200px;
            height: 200px;
            background-color: #eee;
        }
    </style>
    <div class="sidebar"></div>
    <div style="float: left">
        <input type="text">
        <input type="text">
        <input type="text">
        <input type="text">
    </div>
    <script>
        var inputs = document.querySelectorAll('input[type=text]'),
            sidebar = document.querySelector('.sidebar');
        Array.prototype.forEach.call(inputs, function (el) {
            el.addEventListener('focus', function () {
                sidebar.style.backgroundColor = '#e4e';
            })
            el.addEventListener('blur', function () {
                sidebar.style.backgroundColor = '#eee';
            })
        })
    </script>