<html>
<head>
<script language=javascript>
   function setBg(URL)
   {
      document.getElementById("bgExpro").style.backgroundImage="url("+URL+")"
   }
</script>
</head>
<body>
<b>Layer Background</b>
<hr><layer name="buttons" top=50>    <input type="button" value="One" onclick="setBg('1.gif')"><br>
    <input type="button" value="Two" onclick="setBg('2.gif')"><br>
    <input type="button" value="Three" onclick="setBg('3.gif')"><br>
    <input type="button" value="Four" onclick="setBg('4.gif')"><br>
    <input type="button" value="Five" onclick="setBg('5.gif')"><br></layer><div id="bgExpro" bgcolor="red" top=50 left=250 width=300 height=250 style="background-image:url(woyingjie.jpg)">
<b>
<font color="white">Which may or may not read well with the various backgrounds.click the button.</font>
</b>
</div></body>
</html>
 我用ie浏览器

解决方案 »

  1.   

    帮你改一下.<html>
    <head>
    <script language=javascript>
       function setBg(URL)
       {
          document.all.bgExpro.style.backgroundImage='url('+URL+')';
       }
    </script>
    </head>
    <body>
    <b>Layer Background</b>
    <hr><layer name="buttons" top=50>
        <input type="button" value="One" onclick="setBg('csdn.gif')"><br>
        <input type="button" value="Two" onclick="setBg('2.gif')"><br>
        <input type="button" value="Three" onclick="setBg('3.gif')"><br>
        <input type="button" value="Four" onclick="setBg('4.gif')"><br>
        <input type="button" value="Five" onclick="setBg('5.gif')"><br>
    </layer><span id="bgExpro" bgcolor="red" top=50 left=250 width=300 height=250 >
    <b>
    <font color="white">Which may or may not read well with the various backgrounds.click the button.</font>
    </b>
    </span></body>
    </html>详细请查:
    dhtml,html&css
    下载地址:http://www.dqcn.net/net/CSDN/Book/dhtml html&css.chm