This is a discussion on How do I move the scrollbar to a specific position? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi all... How do I move the scrollbar to a specific position? Thanks & Regards Pvinoth....
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Hi all... How do I move the scrollbar to a specific position? Thanks & Regards Pvinoth. |
|
#2
| |||
| |||
| Hi Vinoth... By using the window’s scrollTo() method. you can achive... Example: function moveToTop() { self.scrollTo(0,0); } thnx... |
|
#3
| |||
| |||
| HTMLElement.prototype.scrollBottom = function() { var el = this; // element var h = el.scrollHeight; // height of element scroll var y = el.scrollTop; // vertical scroll offset from top (of scrollHeight) var c = el.clientHeight; // scroll bar height var scrollBottom = h - (y + c); // offset of scroll from bottom return scrollBottom; } You can Refer this url also Javascript - document.body and doctype switching |
|
#4
| |||
| |||
| <html> <body> <input id=”Button1″ type=”button” value=”button” onclick=”foo();” /> <div style=”overflow:scroll; height:300px;” id=”mydiv” runat=”server”> <div style=” background-color:Red; height:800px;” > <div style=”height:300px; background-color:Green;”> </div> </div> </div> </body> </html> In Page_Load if (!ClientScript.IsClientScriptBlockRegistered(”mysc ript”)) { System.Text.StringBuilder sBdr = new System.Text.StringBuilder(); sBdr.Append(”"); sBdr.Append(” function foo(){”); sBdr.Append(” alert(document.getElementById(’” + mydiv.ClientID + “‘).scrollTop);”); sBdr.Append(” }”); sBdr.Append(”"); ClientScript.RegisterClientScriptBlock(typeof(Page ),”myscript”, sBdr.ToString()); } |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cool ScrollBar Compnent | ramesharthanari | Flash Actionscript Programming | 0 | 07-15-2008 05:21 AM |
| Manipulating scrollbar colors using CSS and JavaScript | santhakumar | HTML, CSS and Javascript Coding Techniques | 1 | 11-27-2007 06:55 AM |
| Is it possible to create colored scrollbar in the FIREFOX .... | Archer | HTML, CSS and Javascript Coding Techniques | 2 | 07-27-2007 05:41 AM |
| Set Position of Browsers Scrollbar using Javascript ? | kingmaker | HTML, CSS and Javascript Coding Techniques | 1 | 07-19-2007 12:33 AM |
Our Partners |