Answers for "how to automatically scroll page up after submit in javascript"

PHP
1

php auto scoll page with output

<script>
var scroller = setInterval(function() {  
    window.scrollTo(0,document.body.scrollHeight);
}, 10); // update every 10 ms, change at will
</script>
<?php
// generate 1000 lines of html code
for($i=0; $i<1000; $i++){
    echo $i . "<br>";
    ob_flush(); // flush out the output as we go
    flush(); // same
    usleep(10000); // add some delay to see it in action  
}

?>

<script>
clearInterval(scroller); // stop updating so that you can scroll up 
</script>
Posted by: Guest on November-25-2020

Code answers related to "how to automatically scroll page up after submit in javascript"

Browse Popular Code Answers by Language