RT,点击左边小图片的时候,在右侧的div或者table里,用这个小图片添满,请教高手指导下

解决方案 »

  1.   

    Ob.style.backgroundImage='url(图片)';
      

  2.   

    rightDiv.style.backgroundImage="url(image/name.jpg)"; 
    rightDiv.style.backgroundRepeat="repeat";
      

  3.   


    <html>
    <head>
    <style>
    #img1 {
        float:left;
        width:255px;
        height:142px;
    }
    #imageRepeat {
        float:left;
        margin-left:10px;
        width:600px;
        height:500px;
        border:2px solid red;
    }
    </style>
    <script>
    function fillDiv()
    {
        document.getElementById("imageRepeat").style.background="url("+document.getElementById("img1").src+") repeat";
    }
    </script>
    </head>
    <body>
    <img id="img1" src="01.jpg" onclick="fillDiv()"/>
    <div id="imageRepeat"></div>
    </body>
    </html>运行后单击左边图片,右边的层会填充该图片。