I have a php script that shows a log of its actions as the script proceeds. The log is getting quite long, up to the point where it will echo its information past the bottom
This works:
<script>
setTimeout(printSomething, 1000);
function printSomething(){
for(var i=0; i<10; i++){
document.write("Hello World\n");
document.write("<br>");
}
window.scrollTo(0,document.body.scrollHeight);
setTimeout(printSomething, 1000);
}
</script>
I think what you're looking for is this: http://www.w3schools.com/jsref/met_win_scrollto.asp
And then, used with conjunction with this: http://www.w3schools.com/jsref/prop_element_scrollheight.asp
You can make something like:
function scrollToBottom{
window.scrollTo(0, document.body.scrollHeight);
}
Every 5 seconds, it will scroll the page to the bottom of the page.
function autoScrolling() {
window.scrollTo(0,document.body.scrollHeight);
}
setInterval(autoScrolling, 5000);
// adjust the time limit based on the frequency log gets updated
<html>
<body>
<script type="text/javascript">
setInterval(function() {
document.body.innerHTML += "<p>New log</p><br>"
}, 5000);
</script>
</body>
</html>
function fun()
{
$("div").scrollTop(50);
}
now use
<body onload="fun">