展示
代码
HTML代码:
<button id="button1">点击本按钮,页面滚动高度100像素</button> <img src="//ww1.sinaimg.cn/bmiddle/6aa99f00tw1dkxpxgi4mcj.jpg" height="969" />
JS代码:
document.getElementById("button1").onclick = function() { document.getElementsByTagName("body")[0].scrollTop = 100; document.getElementsByTagName("html")[0].scrollTop = 100; };