Hello,
iI just discovered this thread and was very glad to find a solution to the top of page link with dynamic path.
Just want to add a chunk here that uses this and also uses some javascript (originally found elsewhere and adopted) to show the top of page link
only if the page is
long enough to make sense for a top link:
<script language="JavaScript" type="text/JavaScript">
<!-- inner height -->
var a,b;
if (self.innerHeight) // all except Explorer
{
a = self.innerWidth;
b = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
// Explorer 6 Strict Mode
{
a = document.documentElement.clientWidth;
b = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
a = document.body.clientWidth;
b = document.body.clientHeight;
}
<!-- page height -->
var x,y;
var test1 = document.body.scrollHeight;
var test2 = document.body.offsetHeight;
if (test1 > test2) // all but Explorer Mac
{
x = document.body.scrollWidth;
y = document.body.scrollHeight;
}
else // Explorer Mac;
//would also work in Explorer 6 Strict, Mozilla and Safari
{
x = document.body.offsetWidth;
y = document.body.offsetHeight;
}
if (b+50 < y) {
document.write("<a href=\"[~[*id*]~]#welcome\">top of page</a>")};
</script>
<noscript>
<a href="[~[*id*]~]#welcome">top</a>
</noscript>
I put this chunk into my templates and it works. I have SEF urls and alias urls and alias paths active. You may want to adjust the line with (b+50 <y) to your needs. It says the top link is shown when the page height y (page content) is greater than the visible browser window height + 50 pixels.
This works in IE 6 and IE7 (it should work in Firefox, but there seems to be a problem right now).
Maybe this helps someone
Best regards Guenter