Anchors
Posted: Mon Jun 11, 2007 5:03 pm
I had some issues with HTML anchors not working properly. They would default to index.php#Anchor insead of /index.php?page=Name#Anchor
I wrote a Javascript solution that helped me out and I thought I would share. I am actually using it with pretty url's (domain.com/parent/child#Anchor).
Use the attached JS file (remove the .txt extension). You can either reference the in your template or in specific pages. I did not include it in my Template. I am putting it in the Metadata field under the options tab on just the pages that I am using anchors, with the following code:
To get the anchors to work you need to call the anchor function and pass the anchor name within the function call. Here is how I did it.
You would replace #Top with your anchor name. Be sure to include the Hash Mark (#) in your anchor name.
I tested it in IE 6, IE 7, Avant 11, Netscape 8.1 (A little buggy), and Firefox 2
I wrote a Javascript solution that helped me out and I thought I would share. I am actually using it with pretty url's (domain.com/parent/child#Anchor).
Use the attached JS file (remove the .txt extension). You can either reference the in your template or in specific pages. I did not include it in my Template. I am putting it in the Metadata field under the options tab on just the pages that I am using anchors, with the following code:
Code: Select all
{literal}
<__script__ src="/JS/anchor.js" type="text/javascript"></__script>
{/literal}
Code: Select all
<a href="javascript:anchor('#Top');">^Top</a>
I tested it in IE 6, IE 7, Avant 11, Netscape 8.1 (A little buggy), and Firefox 2