Locate the DIV scroll bar

Source: Internet
Author: User
If there is a drop-down box in the table and a Treeview, all the nodes in the Treeview are obtained from the drop-down menu in the drop-down box. Therefore, after locating the node first, when you select other options in other drop-down boxes, the scrolltop value of the DIV will keep the position of the scroll bar of the previous step. <Body Style = "Background: # eff9fa" Onscroll = "onscrollform ();" onLoad = "formonload ();"
Scroll = "no" Ondblclick = "javascript: Document. form1.submit ();">

<SCRIPT type = "text/JavaScript" Language = "JavaScript">
<! --
Function scrolldiv ()
{
Document. All. Pos. value = Document. All. onlinediv. scrolltop;
// Onlinediv is a div
}
Function formonload ()
{
Onloadforscroll ();
}
Function onloadforscroll ()
{
VaR SPOs = Document. All ["POS"]. value;
If (! SPOs) SPOs = 0;
Document. All. onlinediv. scrolltop = SPOs ;
}
-->
</SCRIPT>

<Form ID = "form1" method = "Post" runat = "server">
//
<Asp: textboxId = "POS" style = "display: none"Runat = "server"> </ASP: textbox>
<Table>
<Tr>
<TD>
<DivId = "onlinediv" onscroll = "scrolldiv ();"Style = "overflow: auto; Height: 169px; width: 280px">
// Add (Treeview, word, more ....)
</Div>
</TD>
</Tr>
</Table>
</Form>

* Ondblclick = "javascript: Document. form1.submit ();" --- custom double-click event

* After the screen is full, the scroll bar is below
<Script language = "JavaScript">
Function Test ()
{
Window. Scroll (0, document. Body. scrollheight)
}
</SCRIPT>

<Body onload = "test ()">
</Body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.