关于div和textarea的自动scroll

1, div
<div style="width:100%; height:95%; overflow-y:scroll">
<div id="command_result" style="height:90%; width:100%"></div>
<div id="command_result_end" style="overflow:hidden; height:1px"></div>
</div>
<script>
document.getElementById("command_result_end").scrollIntoView();
</script>

2, textarea
var obj = document.getElementById("command_result");
obj.scrollTop=obj.scrollHeight

你可能感兴趣的:(UI,Web)