码迷,mamicode.com
首页 > 其他好文 > 详细

使Div滚动条始终处于底部

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

标签:div 滚动条 底部

<!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滚动条始终处于底部

标签:div 滚动条 底部

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!