<div style="width: 100px; height: 100px; background: red;">Иди ко мне</div>
<script>
function myFunc() {
alert( "called function" );
}
var div = document.getElementsByTagName('div')[0],
handler = null;
div.onmouseover = function() {
handler = setTimeout( myFunc, 2000 );
}
div.onmouseout = function() {
clearTimeout( handler );
}
</script>