<!DOCTYPE html> <html> <style> body {width: 5000px} button {position:fixed} </style> <body> <h1>Window 对象</h1> <h2>scrollBy() 方法</h2> <p>单击可滚动文档。</p> <p>请看水平滚动条,可看到效果。</p> <button onclick="scrollWin()" style="position:fixed">水平滚动 100px!</button> <br><br> <script> function scrollWin() { window.scrollBy(100, 0); } </script> </body> </html>