<script type="text/javascript"> $(function() { var $tb = $('textarea[id$=tb1]'); $('input[id$=btnScroll]').toggle( function(e) { e.preventDefault(); scrollArea($tb, $tb[0].scrollHeight); }, function(e) { e.preventDefault(); scrollArea($tb, 0); }); }); function scrollArea(ctrl, ht) { ctrl.animate({ scrollTop: ht }, 1000); } </script>
<body> <form id="form1" runat="server"> <div class="smallDiv"> <h2>Scroll the box contents by clicking on the Button</h2> <br /><br /> <asp:TextBox ID="tb1" runat="server" TextMode="MultiLine" Text="Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum" Rows="5"/> <br /> <asp:Button ID="btnScroll" runat="server" Text="Scroll"/> <br /><br /> Tip: The Text can be scrolled both downwards and upwards. </div> </form> </body>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)