•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Site Layout and Usability section within the Web Development category of DaniWeb, a massive community of 373,533 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,832 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Site Layout and Usability advertiser:
Views: 27676 | Replies: 1 | Solved
![]() |
•
•
Join Date: Aug 2005
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 1
I wrote this little code segment to illustrate the idea of what I want. I'd like to be able to automatically scroll the DIV to the bottom when you add stuff to it.
So, you type something in and click Add Stuff. It will scroll to the bottom so you can see what you just added. That would be awesome.
Thanks in advance
<html>
<head>
<title>Auto Scrolling Div</title>
<head>
<script type="text/javascript">
<!--
function addStuff() {
var stuff = document.getElementById('foo').value;
oldStuff = document.getElementById('bar').innerHTML;
newStuff = oldStuff + ' ' + stuff;
document.getElementById('bar').innerHTML = newStuff;
}
-->
</script>
</head>
<body>
<div id="bar" style="overflow: auto; height: 150px; width: 100px;">
Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff
Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff
Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff
</div>
<input type="text" id="foo">
<input type="submit" value="Add Stuff" onclick="addStuff()">
</body>
</html>So, you type something in and click Add Stuff. It will scroll to the bottom so you can see what you just added. That would be awesome.
Thanks in advance
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Site Layout and Usability Marketplace
- AutoScrolling a DIV tag (JavaScript / DHTML / AJAX)
- css div's and tables table cells and scrolling (HTML and CSS)
- About DIV tags (HTML and CSS)
Other Threads in the Site Layout and Usability Forum
- Previous Thread: Stretching a table image with CSS
- Next Thread: need help writing a small script on a web site but dont know the language


Linear Mode