There are three ways to control the position of the scroll bar in JavaScript, so let's take a look at it separately.
Method One: Using scroll function to realize
Scroll (x,y);
X represents the position of the horizontal scroll bar, which controls the left and right positions, when 0 o'clock represents the leftmost, and when Document.body.scrollWidth is the rightmost
Y represents the position of the longitudinal scroll bar, which is the control up and down position, when 0 o'clock represents the top, and when it is document.body.scrollHeight, represents the bottom
Method Two: Using Scrollby function to realize
Scrollby (X,y);
X and y represent the same meaning as the first method;-)
Method Three: Using Scrollto function to realize
Scrollto (X,y);
X and y represent the same meaning as the first method;-)
Incidentally, if you want to control the scroll bar of the parent frame in the frame, remember to add parent before the function, for example, Parent.scroll (0,0);
Controlling ScrollBar with JavaScript (scroll bar)
The following are the default automatic scrolling to the bottom, you need to scroll to the top just change the document.body.scrollHeight to 0.
Method One: Using scroll method to realize
<body onload= "Scroll (0,document.body.scrollheight)" > <script> document.write (New Array). Join ("< Br> ") </script>
Method Two: Using Scrollby method to realize
<body onload= "Scrollby (0,document.body.scrollheight)" > <script> document.write (New Array). Join ("&L T;br> ") </script>
Method Three: Using Scrollto method to realize
<body onload= "Scrollto (0,document.body.scrollheight)" > <script> document.write (New Array). Join ("& Lt;br> ") </script>
If you are in the frame, you need to control the frame of the scrollbar, then add the parent, such as Parent.scrollto (0,0);