SOURCE

console 命令行工具 X clear

                    
>
console
function add()
{
  var now = new Date();
  var div = document.getElementById('box');
  div.innerHTML = div.innerHTML + 'time_' + now.getTime() + '<br />';
  div.scrollTop = div.scrollHeight;
}
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>滚动条在底部</title>
    <link rel="stylesheet" href="css/app.css">
</head>
<body>

<h4>请点击“插入一行”按钮,插入最新信息,当出现滚动条时,滚动条将自动保持在底部。</h4>

<div id="box"></div>
<input type="button" value="插入一行" onclick="add();">
</body>
<script src="js/app.js"></script>
</html>
#box {
    overflow: auto;
    height: 100px;
    width: 400px;
    border: 1px solid #999;
}