cancel
Showing results for 
Search instead for 
Did you mean: 

navigation->goto_page( 'page1.htm' ) and and html anchors

Former Member
0 Kudos

Hello,

we often use the command "navigation->goto_page", e.g. from handler OnInputProcessing in a BSP.

Now i have the must to give an html anchor with to the page, i tried it like this:

navigation->goto_page( 'page1.htm#anchor1' ).

But the i get the following error:

Access not possible using 'NULL' object reference

Thank you for any idea, how to handle this problem.

Regards

Marcus

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

i found a solution.

1. Create a page attribute 'anker' auto, string

2. Put the following Code in your BSP layout:

-

-


<script language="javascript"> function getPositionanker(id) { /* var elem; try{ if (document.getElementById(id)) throw true; else throw false; } catch(e){ if (e) {elem=document.getElementById(id);} else {return 0;} } */ var elem=document.getElementById(id); var tagname="", y=0; while ((typeof(elem)=="object")&&(typeof(elem.tagName)!="undefined")) { y+=elem.offsetTop; //Offset des jeweiligen Elements addieren tagname=elem.tagName.toUpperCase(); // tag-Name ermitteln, Grossbuchstaben //wenn beim Body-tag angekommen elem fuer Abbruch auf 0 setzen if (tagname=="BODY") elem=0; // wenn elem ein Objekt ist und offsetParent enthaelt Offset-Elternelement ermitteln if (typeof(elem)=="object") if (typeof(elem.offsetParent)=="object") elem=elem.offsetParent; } return y; } function scrollToAnker(anker){ var y=getPositionanker(anker); window.scrollTo(0,y - 30); } var anker = "<%= me->anker %>"; </script> <% if me->anker is not initial. %> <body onload="scrollToAnker(anker);"> <% free me->anker. %> <% else. %> <body> <% endif. %>

-

-


now you can fill the attribut 'ankerÄ and your site will automitcally scroll to th anchor without the need to be reload - i know its not a nice workout using JavaScript but it works ...

Regards Marcus

Former Member
0 Kudos

actually I met the same problem, but I dont find any solution. If I find something, I will send a response