用数组么?   
我是这样写的:
 var int = document.getElementById("di"+dijiadd).length;
   for(var i=0;i<int;i++){
 every = parseInt(document.getElementById("di"+dijiadd)[i].style.top);
   document.j.dj4.value = every; 
 
   }

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <style type="text/css">
    tr:hover{ color:#f00}
    table tr td{ width:400px; height:20px; border:#CCCCCC 1px solid;}
    </style>
    </head>
    <body>
    <img src="111.jpg" style="top: 12px;position: absolute;"/>
    <img src="111.jpg" style="top: 12px;left: 40px;position: absolute;"/>
    <img src="111.jpg" style="top: 52px;position: absolute;"/>
    <img src="111.jpg" style="top: 52px;left: 40px;position: absolute;"/>
    </body></html><script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.js"></script>
    <script>
    $(function(){
    $('img').each(function(){
    alert($(this).css('top'));
    });
    });
    </script>
      

  2.   

     var int = document.getElementsByTagName("img").length;
        for(var i=0;i<int;i++){
      every = parseInt(document.getElementsByTagName("img")[i].style.top);
        document.j.dj4.value = every; 
      
        }
    这样写试试