BBC_Rey
03-26-2005, 12:21 PM
How do you make a "Go to top"-button, the one when you press it, the page goes back tot he top.
|
Click to See Complete Forum and Search --> : "Go to Top"-button How? BBC_Rey 03-26-2005, 12:21 PM How do you make a "Go to top"-button, the one when you press it, the page goes back tot he top. js_prof_cons 03-26-2005, 01:05 PM Generally, this can be done just using:<a href="#" title="Top of Page">Top!</a> If you'd like to position within the page, you'll have to assign anchor names:<a name="middle"></a>. The link to access this part of a page would be:<a href="#middle" title="Middle of Page">Middle!</a>. It's quite simple. In addition, accessing the URL, http://your-site/index.php#middle, would load the site, then navigate to the anchor, middle, if it exists, or the top otherwise. Wart_Hog 03-26-2005, 01:12 PM You can use an id attribute on the top-most element and link to that. For instance, if this is your header: <div id="top"> </div> You can link to it from the bottom of the page by using: <a href="#top">Top of the Page</a> Hope this helps, -Mike js_prof_cons 03-26-2005, 01:30 PM You can use an id attribute on the top-most element and link to that. For instance, if this is your header: <div id="top"> </div>Just be careful doing this. Quicks test in Internet Explorer show that the particular browser will go to the anchors before <div> tags, and the name attribute before id. However, your method would be just as effective. Wart_Hog 03-26-2005, 02:10 PM Just be careful doing this. Quicks test in Internet Explorer show that the particular browser will go to the anchors before <div> tags, and the name attribute before id. However, your method would be just as effective.Which version? This is weird (although not really, considering the subject matter): I ran your link through IE5.2mac with no results. The page "stayed" at the bottom, while my suggestion worked. :confused: Your have the same problem as I am. I love you IE. js_prof_cons 03-26-2005, 02:15 PM I just wrote the code:<br><br> <a name="middle"></a> <script>for(var i=0;i<35;i++) document.write('<br>');</script> <a href="#middle">Middle</a>I know its not presentable, but it works. Anyway, IE (6.0) and Firefox (1.75) both succeeded in bringing the scroll back to the middle, neither the complete top nor bottom. BBC_Rey 03-26-2005, 02:57 PM Thank you for the information ^^. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |