grippat Posted February 1, 2008 Share Posted February 1, 2008 Is there a way to use JS to go to a target on a page? When a user clicks on a button I want the JS to automatically bring them to a point lower on the webpage. Is there another better way to achieve the same goal? Link to comment Share on other sites More sharing options...
jeffman Posted February 1, 2008 Share Posted February 1, 2008 You should be able to manipulate document.body.scrollTop with reference to some element's offset.top .But why? Anchors are so simple, the core of HTML. Link to comment Share on other sites More sharing options...
jesh Posted February 1, 2008 Share Posted February 1, 2008 Another way might be to set the location.href property. location.href = location.href + '#bottom'; Link to comment Share on other sites More sharing options...
Ingolme Posted February 1, 2008 Share Posted February 1, 2008 Another way might be to set the location.href property.location.href = location.href + '#bottom'; Or location.hash = "#bottom".You need an anchor called <a id="bottom"> for it. Link to comment Share on other sites More sharing options...
Synook Posted February 2, 2008 Share Posted February 2, 2008 Or just <a href="#lower">Click to go lower</a><!.. Somewhere lower down on the page --><a id="lower"></a> There! No need for JS. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.