on 04-14-2004 2:23 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
actually I met the same problem, but I dont find any solution. If I find something, I will send a response
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.