首页 > 其他 > 详细

使Div滚动条始终处于底部

时间:2014-08-22 18:12:50      阅读:311      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html PUBLIC>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

<script type="text/javascript">     

function add() {      

var now = new Date();      

var nowtime = now.getFullYear()+‘/‘+(now.getMonth()+1)+‘/‘+now.getDate()+‘  ‘+now.getHours()+‘:‘+now.getMinutes()+‘:‘+now.getSeconds();

var div = document.getElementById(‘scrolldIV‘);      

div.innerHTML = div.innerHTML + ‘<div style="height:20px">当前时间:  ‘ + nowtime + ‘<div/>‘; 

div.scrollTop = div.scrollHeight;}  

     

</script>

</head>


<body>

<div id="scrolldIV" style="overflow:scroll; height: 100px; width: 400px; border: 1px solid #999;"></div>      

    <input type="button" value="显示时间" onclick="add();">

</body>

</html>


本文出自 “喜欢放肆爱需克制” 博客,请务必保留此出处http://tiaopitu.blog.51cto.com/9191152/1543507

使Div滚动条始终处于底部

原文:http://tiaopitu.blog.51cto.com/9191152/1543507

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!