Mega Code Archive

 
Categories / JavaScript Tutorial / Window
 

Scroll the window by using window scrollBy

< html> <head> <title>Window Scroller</title> <script language="javascript" type="text/javascript"> <!-- function scrollWin() {      var y = prompt("Pixels to scroll?","120");      if (isNaN(y))         return alert("Numbers only please");      window.scrollBy(0, y); } //--> </script> </head> <body> <h1>Window Scroller</h1> <P><a href="javascript:scrollWin()">Scroll Window</a></p> <P> 1<br /> 2<br /> 3<br /> 4<br /> 5<br /> 6<br /> 7<br /> 8<br /> 9<br /> 10<br /> 11<br /> 12<br /> 13<br /> 14<br /> 15<br /> 16<br /> 17<br /> 18<br /> 19<br /> 20<br /> 21<br /> 22<br /> 23<br /> 24<br /> 25<br /> 26<br /> 27<br /> 28<br /> 29<br /> 30<br /> 31<br /> 32<br /> 33<br /> 34<br /> 35<br /> 36<br /> 37<br /> 38<br /> 39<br /> 40<br /> 41<br /> 42<br /> 43<br /> 44<br /> 45<br /> 46<br /> </p> <P>THE END</p> </body> </html>