HTML DOM backgroundRepeat ÊôÐÔ
¶¨ÒåºÍÓ÷¨
backgroundRepeat ÊôÐÔÉèÖñ³¾°Í¼ÏñÊÇ·ñ¼°ÈçºÎÖØ¸´¡£
Óï·¨£º
Object.style.backgroundRepeat=repeat_value
²ÎÊý | ÃèÊö |
---|---|
repeat | ĬÈÏ¡£±³¾°Í¼Ïñ½«ÔÚ´¹Ö±·½ÏòºÍˮƽ·½ÏòÖØ¸´¡£ |
repeat-x | ±³¾°Í¼Ïñ½«ÔÚˮƽ·½ÏòÖØ¸´¡£ |
repeat-y | ±³¾°Í¼Ïñ½«ÔÚ´¹Ö±·½ÏòÖØ¸´¡£ |
no-repeat | ±³¾°Í¼Ïñ½«½öÏÔʾһ´Î¡£ |
ʵÀý
±¾Àý½öÔÚ y ÖáÖØ¸´±³¾°Í¼Ïñ£º
<html>
<head>
<style type="text/css">
body
{
background-color:#FFCC80;
background-image:url(bgdesert.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>