Click here to Skip to main content
12,768,041 members (46,332 online)
Rate this:
Please Sign up or sign in to vote.
Hi ,
The .aspx page looks like...
I have a dropdownlist which contains the value like one,two,three,four,five.







On selecting the 'four' in the dropdownlist,The page needs to scroll and points the 'Four:' .The functionality will works similar to the microsoft word document.On click of table of contents heading,the page will navigate and shows the proper definition.
Please help me!!!
Posted 27-Dec-12 6:38am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You are going to need to use anchors (<a>)[^]

Then use JavaScript to attach to the onChange of the select and then just set the hash for the window to jump down to the related anchor[^]
priya9826 27-Dec-12 11:52am
It does nt works for my scenario.Will you send the sample code for me
Adam R Harris 27-Dec-12 11:56am
What do you mean it wont work?
Post the code you have and *exactly* what isn't working.
priya9826 27-Dec-12 13:58pm
<script type="text/javascript">

var pageElement = document.getElementById("Div3");
var showSearch = function scrollToElement(pageElement) {
var positionX = 0,
positionY = 0;

while (pageElement != null) {
positionX += pageElement.offsetLeft;
positionY += pageElement.offsetTop;
pageElement = pageElement.offsetParent;
window.scrollTo(positionX, positionY);


This is my code.I dont know how to use loaction.hash.The code which I have written is not working.
Adam R Harris 27-Dec-12 14:36pm
Check the links in my solution to learn how to use location.hash.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100