JavaScript 参考手册
Style backgroundRepeat 属性
设置背景图像为垂直方向重复
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>蜜蜂教程(mifengjc.com)</title> <style type="text/css"> body { background: #f3f3f3 url("/examples/img_tree.png"); } </style> <script> function displayResult() { document.body.style.backgroundRepeat = "repeat-y"; } </script> </head> <body> <button type="button" onclick="displayResult()">垂直重复背景图像</button> <br> <h1>Hello World!</h1> <p>这是一个段落</p> </body> </html>
运行结果:
点击运行 »