Scroll a window in Javascript in JavaScript
Description
The following code shows how to scroll a window in Javascript.
Example
<!-- www. j av a2 s. c om-->
<!DOCTYPE HTML>
<html>
<body>
<p>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
This is a test. <br/>
</p>
<script>
window.scrollTo(0, 400);
</script>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Browser Window
Access the window owner through opener prop...
Add link and open new windows after clickin...
Check the visibility of menubar, toolbar, l...
Close a window in JavaScript
Close the newly opened window by calling th...
Create a new window and add form controls i...
Get the current URL of the document in the ...
Get window location on the screen in Javasc...
Get window name specified when new windows ...
Get window size, width, height in JavaScrip...
Move a window by 100 pixels in JavaScript
Move a window to a new location in JavaScri...
Move window to the left in JavaScript
Open a new window in JavaScript
Open a window and resize in JavaScript
Open new window and set window location in ...
Resize a window in JavaScript
Tell if a pop-up was blocked by checking th...
Use focus() method places focus on the wind...
Use frames property to access frame instanc...
Use window.frames["frameName"].length in Ja...
Use window.onscroll to add the onscroll eve...
Access the window owner through opener prop...
Add link and open new windows after clickin...
Check the visibility of menubar, toolbar, l...
Close a window in JavaScript
Close the newly opened window by calling th...
Create a new window and add form controls i...
Get the current URL of the document in the ...
Get window location on the screen in Javasc...
Get window name specified when new windows ...
Get window size, width, height in JavaScrip...
Move a window by 100 pixels in JavaScript
Move a window to a new location in JavaScri...
Move window to the left in JavaScript
Open a new window in JavaScript
Open a window and resize in JavaScript
Open new window and set window location in ...
Resize a window in JavaScript
Scroll a window in Javascript in JavaScript
Set URL location for a window in JavaScriptTell if a pop-up was blocked by checking th...
Use focus() method places focus on the wind...
Use frames property to access frame instanc...
Use window.frames["frameName"].length in Ja...
Use window.onscroll to add the onscroll eve...