文档加载完后再调用
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
.style01{
width:200px;
height:200px;
float:left;
background:#F63;}
</style>
</head><body>
<div class="style01"></div>
<div class="style01"></div>
<div class="style01"></div>
<div class="style01"></div>
<div class="style01"></div>
</body>
</html>
<script>
     var rows=document.getElementsByClassName("style01")
  for(i=0;i<rows.length;i++){
   rows[i].onmouseover=function(){
   this.style.border="#000 solid 1px"
        }       rows[i].onmouseout=function(){
       this.style.border="0"
        }
 
 }</script>