Hello, I have a web page with many items on it, it takes a while for it to completely load and it takes a lot of vertical scrolling from the head to the foot of the page. The problem is that the vertical scroll bar would stick at the top of the page and not scroll down when new items are loaded to the window (page not completely received yet). How can I make the vertical scroll bar auto-scroll to the end of the page while new items are being added to the page during the loading process? I use IE 6.
Supposing your HTML code is loaded first and then the images, you can use somethign like this: <html> <head> <script type="text/javascript"> function moveWin() { window.scroll(0,10000); setTimeout('moveWin();',1000); } </script> </head> <body onLoad="moveWin();"> <!-- many pictures --> </body> </html> Code (markup): If you have a huge HTML, that method won't work, so you need to use frames or iframes.
or you can place a named link at the bottom of your page, and change the href.location value to point to that anchor: <html> <head> <script type="text/javascript"> function pointToBottom(){ window.href.location = "this_page.html#bottomlink"; }</script> </head> <body onLoad="pointToBottom()"> <!-- page here --> <a name="bottomlink"> </a> </body> </html> HTML: this might refresh your page though, but i'm not sure
Here is what I use.. it's just autoscroll.. you can play with the division factors to get a different time. <SCRIPT language=JavaScript1.2> //change 1 to another integer to alter the scroll speed. Greater is faster var speed=1 var currentpos=0,alt=1,curpos1=0,curpos2=-1 function initialize(){ startit() } function scrollwindow(){ if (document.all && !document.getElementById) temp=document.body.scrollTop else temp=window.pageYOffset if (alt==0) alt=2 else alt=1 if (alt==0) curpos1=temp else curpos2=temp if (curpos1!=curpos2){ if (document.all) currentpos=document.body.scrollTop+speed else currentpos=window.pageYOffset+speed window.scroll(0,currentpos) } else{ currentpos=0 window.scroll(0,currentpos) } } function startit(){ setInterval("scrollwindow()",400) } window.onload=initialize </SCRIPT>