<! Doctype HTML public>
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> untitled document </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 ('rolldiv ');
Div. innerhtml = div. innerhtml + '<Div style = "height: 20px"> current time:' + 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 = "display time" onclick = "add ();">
</Body>
</Html>
This article from the "Love likes love need restraint" blog, please be sure to keep this source http://tiaopitu.blog.51cto.com/9191152/1543507
Keep the DIV scroll bar at the bottom