<body>
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
function addDiv(){
var newDiv = document.createElement('div')
newDiv.className="happy"
newDiv.style.width="100px";
newDiv.style.height="100px";
newDiv.style.border="1px solid red";
newDiv.onmouseover=function (){this.style.backgroundColor='red'}
document.body.appendChild(newDiv)
} addDiv()
</script>
</head>
<body>
</body>
</html>