Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi ,
The .aspx page looks like...
I have a dropdownlist which contains the value like one,two,three,four,five.

one::

Two:

Three:

Four:


Five:

Six:

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

1 solution

You are going to need to use anchors (<a>) http://www.w3schools.com/html/html_links.asp[^]

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 http://www.w3schools.com/jsref/prop_loc_hash.asp[^]
 
Share this answer
 
Comments
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);
}
}


</script>

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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900