Javascript examples for CSS Style Property:backgroundRepeat
Set a background-image to repeat horizontally or vertically:
<!DOCTYPE html> <html> <head> <style> body {//from ww w .j av a2 s . co m background: #f3f3f3 url('http://java2s.com/resources/a.png'); } </style> </head> <body> <h1>Hello World!</h1> <button type="button" onclick="repeatVert()">Repeat background image only vertically</button> <button type="button" onclick="repeatHori()">Repeat background image only horizontally</button> <script> function repeatVert() { document.body.style.backgroundRepeat = "repeat-y"; } function repeatHori() { document.body.style.backgroundRepeat = "repeat-x"; } </script> </body> </html>