Ways to Have Your Web Page Jump Focus to a Certain Spot on a Page Using a Text or Image Link or a Button with an Event Handler
- Make an anchor link
- Make your event handler execute a function that puts the focus on an anchor link with code like: var q=document.anchors; q[0].focus()
- Make your event handler execute a function that uses the window methods window.scroll(), window.scrollBy(), or window.scrollTo()—hopefully use these with the coords property of the anchor object
Window methods like window.scroll() have the advantage of allowing the visitor to go to an exact window coordinate, but that's also their disadvantage, since if visitors have reset the font size of the browsers to large and your divs stretch and flow downwards, who knows what corresponds to that coordinate? We therefore recommend anchor links for most purposes because even if there's no text at the target, you can put an invisible, absolutely positioned 1-pixel gif image there with a NAME attribute as a target.