日期:2014-05-16 浏览次数:20439 次
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> function setBg(url) { document.getElementById('test').style.backgroundImage="url(./"+url+")"; } </SCRIPT> </HEAD> <BODY> <B>Layer Background</B> <HR> <LAYER NAME="buttons" top="50"> <FORM> <INPUT TYPE="button" VALUE="First" onClick="setBg('demo.jpg')"> <BR> <INPUT TYPE="button" VALUE="Two" onClick="setBg('1.jpg')"> <BR> <INPUT TYPE="button" VALUE="Three" onClick="setBg('three.gif')"> <BR> <INPUT TYPE="button" VALUE="Four" onClick="setBg('four.gif')"> <BR> <INPUT TYPE="button" VALUE="Five" onClick="setBg('five.gif')"> <BR> </FORM> </LAYER> <LAYER id="test" NAME="bgexpro" BGCOLOR="blue" top="50" left="250" width="300" height="250"> <B><FONT COLOR="red">which may or may not read well with the various backgrounds.click the button</FONT></B> </LAYER> </BODY> </HTML>
------解决方案--------------------
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> function setBg(url) { document.body.style.background="url("+url+")"; } </SCRIPT> </HEAD> <BODY> <B>Layer Background</B> <HR> <LAYER NAME="buttons" top="50"> <FORM> <INPUT TYPE="button" VALUE="First" onClick="setBg('first.gif')"> <BR> <INPUT TYPE="button" VALUE="Two" onClick="setBg('two.gif')"> <BR> <INPUT TYPE="button" VALUE="Three&qu