Pragmatism in code

Regular hyperlinks and anchors are fine for navigating pages in most situations, but i found that whilst trying to add an anchor to the top of a dynamically created page, so that i could add a 'return to top of page' link to the bottom, there was nowhere to add the code. A different approach was required.

The solution I found was to use the javascript scroll command. This simply resides at the location you require the link - in my case at the bottom of the page. The code I used was as follows:


<a href="javascript:scroll(0,0)">^Top</a>


Obviously you can replace the '^Top' text with whatever you require.