五月综合缴情婷婷六月,色94色欧美sute亚洲线路二,日韩制服国产精品一区,色噜噜一区二区三区,香港三级午夜理伦三级三

您現(xiàn)在的位置: 365建站網(wǎng) > 建站教程 > JavaScript 教程 > HTML DOM background 屬性

HTML DOM background 屬性

此節(jié)有 132 人學(xué)習(xí)過     參與評(píng)論

定義和用法

background 屬性在一個(gè)聲明中設(shè)置所有的背景屬性。

語法:

Object.style.background=background-color background-image
background-repeat background-attachment background-position
參數(shù) 描述
background-color 設(shè)置元素的背景色。
  • color-name
  • color-rgb
  • color-hex
  • transparent
background-image 設(shè)置背景圖像。
  • url(URL)
  • none
background-repeat 設(shè)置背景圖像是否及如何重復(fù)。
  • repeat
  • repeat-x
  • repeat-y
  • no-repeat
background-attachment 背景圖像是否固定或者隨著頁面的其余部分滾動(dòng)。
  • scroll
  • fixed
background-position 設(shè)置背景圖像的起始位置。
  • top left
  • top center
  • top right
  • center left
  • center center
  • center right
  • bottom left
  • bottom center
  • bottom right
  • x% y%
  • xpos ypos

實(shí)例

下面的例子改變了文檔背景的樣式:

<html>
<head>
<script type="text/javascript">
function setStyle()
{
document.body.style.background="#FFCC80 url(bgdesert.jpg) repeat-y";
}
</script>
</head>
<body>

<input type="button" onclick="setStyle()"
value="Set background style" />

</body>
</html>

親自試一試

改變文檔背景的樣式

如對(duì)本文有疑問,請(qǐng)?zhí)峤坏浇涣髡搲?,廣大熱心網(wǎng)友會(huì)為你解答!! 點(diǎn)擊進(jìn)入論壇

發(fā)表評(píng)論 (132人查看,0條評(píng)論)
請(qǐng)自覺遵守互聯(lián)網(wǎng)相關(guān)的政策法規(guī),嚴(yán)禁發(fā)布色情、暴力、反動(dòng)的言論。
昵稱:
最新評(píng)論
------分隔線----------------------------
JavaScript 教程目錄

其它欄目

· 建站教程
· 365學(xué)習(xí)

業(yè)務(wù)咨詢

· 技術(shù)支持
· 服務(wù)時(shí)間:9:00-18:00
365建站網(wǎng)二維碼

Powered by 365建站網(wǎng) RSS地圖 HTML地圖

copyright © 2013-2024 版權(quán)所有 鄂ICP備17013400號(hào)