JS控制滚动条的位置:
window.scrollTo(x,y);
竖向滚动条置顶(window.scrollTo(0,0);
竖向滚动条置底 window.scrollTo(0,document.body.scrollHeight)
JS控制TextArea滚动条自动滚动到最下部
document.getElementById('textarea').scrollTop = document.getElementById('textarea').scrollHeight
实际应用代码:
<body style="background:#c0c0c0" onload="window.scrollTo((document.body.scrollWidth-document.body.offsetWidth)/2,0)">文章转载自:http://dpn525.iteye.com/blog/1684441