Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 10th, 2013  |  syntax: HTML  |  size: 2.18 KB  |  views: 45  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function OnScrollDiv() {
  5.     var div1 = document.getElementById("div1");
  6.     var div2 = document.getElementById("div2");
  7.     div2.scrollTop = div1.scrollTop * 2;
  8.     alert(div1.scrollTop);
  9.     alert(div2.scrollTop);
  10. }
  11. </script>    
  12. </head>
  13. <body>
  14.     <div style="width: 250px; height: 250px; overflow: scroll; float: left;" id="div1" onscroll="OnScrollDiv();">1 i dont know whhy i am typing this<br>2 i dont know whhy i am typing this<br>3 i dont know whhy i am typing this<br>4 i dont know whhy i am typing this<br>i dont know whhy i am typing this<br>i dont know whhy i am typing this<br>i dont know whhy i am typing this<br>i dont know whhy i am typing this<br>i dont know whhy i am typing this<br>i dont know whhy i am typing this<br>i dont know whhy i am typing this<br>i dont know whhy i am typing this<br>i dont know whhy i am typing this<br>
  15.     </div>
  16.     <div style="width: 150px; height: 250px; overflow: scroll; float: left;" id="div2">1 Start of div2<br>2 Start of div2<br>3 Start of div2<br>4 Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>Start of div2<br>
  17.     </div>
  18. </body>
clone this paste RAW Paste Data