<div id="block1" onMouseOver="hoverClass('block2',1);" onMouseOut="hoverClass('block2',2);">текст1</div>
<div id="block2">текст2</div>
<script>
var block1 = document.getElementById('block1');
var block2 = document.getElementById('block2');
block1.onmouseover = function(){
block2.className = 'active';
}
block1.onmouseout = function(){
block2.className = '';
}
</script>
или, если нужно тупо менять css, то проще в тыщу раз:
<div id="block1" onMouseOver="hoverClass('block2',1);" onMouseOut="hoverClass('block2',2);">текст1</div>
<div id="block2">текст2</div>
<style>
#block1:hover + #block2{
color: red;
}
</style>