background

英 [?b?kgra?nd]   美 [?b?k?ɡra?nd]  

n.(畫等的)背景;底色;背景資料;配樂

復(fù)數(shù): backgrounds

repeat

英 [r??pi:t]   美 [r??pit]  

vt.重復(fù);復(fù)述,背誦

vi.重做;重復(fù)投票

n.重復(fù);(節(jié)目)重演;重復(fù)的事物

第三人稱單數(shù): repeats 復(fù)數(shù): repeats 現(xiàn)在分詞: repeating 過去式: repeated 過去分詞: repeated

javascript backgroundRepeat屬性 語法

作用:設(shè)置背景圖像是否及如何重復(fù)。

語法:Object.style.backgroundRepeat=repeat_value

參數(shù):repeat    默認。背景圖像將在垂直方向和水平方向重復(fù)。    repeat-x    背景圖像將在水平方向重復(fù)。    repeat-y    背景圖像將在垂直方向重復(fù)。    no-repeat    背景圖像將僅顯示一次。    

javascript backgroundRepeat屬性 示例

<html>
<head>
<style type="text/css">
body
{
background-color:#FFCC80;
background-image:url(http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg);
}
</style>
<script type="text/javascript">
function changeRepeat()
{
document.body.style.backgroundRepeat="repeat-y";
}
</script>
</head>
<body>

<input type="button" onclick="changeRepeat()"
value="Repeat background-image only on the y-axis" />

</body>
</html>

運行實例 ?

點擊 "運行實例" 按鈕查看在線實例