backgroundImage 属性设置元素的背景图像。
</>code
- Object.style.backgroundImage=url(URL)|none
参数 | 描述 |
---|---|
url(URL) | 图像的路径。 |
none | 无背景图像。 |
提示:请设置一种可用的背景颜色,这样的话,假如背景图像不可用,页面也可获得良好的视觉效果。
本例设置了背景图像:
</>code
- <html>
- <head>
- <script type="text/javascript">
- function changeStyle()
- {
- document.body.style.backgroundColor="#FFCC80";
document.body.style.backgroundImage="url(bgdesert.jpg)";
- }
- </script>
- </head>
- <body>
- <input type="button" onclick="changeStyle()"
- value="Set background image" />
- </body>
- </html>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号