Click here to Skip to main content
Rate this: bad
good
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.
 
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 27-Dec-12 6:38am

1 solution

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

Solution 1

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[^]
  Permalink  
Comments
priya9826 at 27-Dec-12 11:52am
   
It does nt works for my scenario.Will you send the sample code for me
Adam R Harris at 27-Dec-12 11:56am
   
What do you mean it wont work?
Post the code you have and *exactly* what isn't working.
priya9826 at 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 at 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
0 George Jonsson 175
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2014
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