改变背景图片出错!!!!!
<html>
<head>
<script language=javascript>
function setBg(URL)
{
document.bgExpro.background.src=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>
<layer name="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>
</layer>
</body>
</html>
问题点数:20、回复次数:4Top
1 楼xiaozx(老德)回复于 2004-09-02 21:00:27 得分 0
怎么不能该边背景图片呢?Top
2 楼woyingjie(Hobo)回复于 2004-09-02 21:19:13 得分 10
<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浏览器Top
3 楼wanghr100(灰豆宝宝.net(努力工作))回复于 2004-09-02 21:24:56 得分 10
帮你改一下.
<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.chmTop
4 楼xiaozx(老德)回复于 2004-09-02 21:26:38 得分 0
上面是书上的一个例子,怎么会不行呢?Top




