Anne van Kesteren

Simple DOM scripting

This is what you want:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<title>Javascript test</title>
<style type="text/css">
 div{width:10em;height:10em;background:#000;color:#fff}
</style>
<script type="text/javascript">
window.onload = function(){
 div = document.getElementsByTagName('div')[0];
 div.onmouseover = function(){
  div.style.backgroundColor = '#fff';
  div.style.color = '#000';
 }
}
</script>
<div>
 <p>That <code>div</code> element.
</div>

Or at least, something like this.

related
Learning JavaScript