<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            .top{
                float: left;
                margin-left: 22px;
                margin-top: 30px;
                height: 320px;
                width: 240px;
            }
            .top img{
                width: 100%;
                height: 100%;
            }
        </style>
    <body>
        <div class="top">
            <img class="tu1" src="../pic/1.jpg">
        </div>
    </body>
</html>
<script type="text/javascript">
    //1、先用js获取到div的内容
    document.getElementsByClassName('top').innerHTML;
    var re = "";
    var tu = 1;
    for (var i = 0; i < 9; i++) {
        tu++;
        re += '<div class="top">' +
            '<img class="tu1" src="../pic/'+tu+'.jpg">' +
            '</div>';
    }
    document.writeln(re);

</script>
12-13 03:40