Javascript examples for DOM:Element scrollLeft
Element scrollLeft Property - Scroll the contents of <body> by 30 pixels horizontally and 10 pixels vertically:
<!DOCTYPE html> <html> <head> <style> body {//ww w.j a va 2 s.com height: 2000px; width: 2000px; } button { position: fixed; } </style> </head> <body> <button onclick="myFunction()">Scroll contents of body</button><br><br> <script> function myFunction() { var body = document.body; // For Chrome, Safari and Opera var html = document.documentElement; // Firefox and IE body.scrollLeft += 30; body.scrollTop += 10; html.scrollLeft += 30; html.scrollTop += 10; } </script> </body> </html>