JSP滚动条自动滚到底部
js DIV滚动条自动滚到底部 <script language="javascript">
function sendText()
{
var e=document.getElementById("div1")
var inp=document.getElementById("inp")
e.innerText=e.innerText+"\n"+inp.value;
//e.scrollTop=e.scrollHeight;
}
function sc()
{
var e=document.getElementById("div1")
e.scrollTop=e.scrollHeight;
}
var s=setInterval("sc()",200)
</script>
<div id="div1" style="border:1px #ff9966 dashed;width:400;height:100;overflow-x:hidden;overflow-y:scroll">
</div>
<input type="text" id="inp" style="width:300">
<input type="button" onclick="sendText()" value="发送">