惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Jina AI
Jina AI
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
I
InfoQ
L
LangChain Blog
The Cloudflare Blog
IT之家
IT之家
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
博客园 - 聂微东
美团技术团队
博客园_首页

博客园 - wenbo

启用 Sql Server 代理 radio 合并DataTable c#分页打印类 ASP.NET安全性 DataFormatString sql 随机数 alter table SQL数据库用户只有“名称”而无“登陆名”解决 override,new location.href 获取当前地址 JS获取当前URL Javascript 操作select控件大全(新增、修改、删除、选中、清空、判断存在等) 获取下拉列表选中项的值和文本 c# c#分页样式 onperInit_onLoadComplete 清空日志 VS2005快捷键大全
如何用js控件div的滚动条,让它在内容更新时自动滚到底部?
wenbo · 2008-11-14 · via 博客园 - wenbo

<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="发送">