Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Position scrollbar using window.location.hash

Status
Not open for further replies.

Isadore

Technical User
Feb 3, 2002
2,167
US
After much searching around for a solution to position a scrollbar inside a division which is made visible through a javascript call I came up with the following solution using anchors.

I am uploading this solution that someone may save a few minutes if encountering the same issue. Works well in IE and FF.

Button is clicked and the following code executed:

Code:
function showdiv1(){  
  document.getElementById('div1').style.display='block';
  window.location.hash = "sec1";
}

..where...

<a name="sec1"/>

..is positioned within the newly visible div such that the division opens up at the desired scroll level.

 
My apologies! Thought this was a helpful tip thread - no question to answer. Of course, a better way is always welcome.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top