Welcome Guest, Not a member yet? Register   Sign In
named anchor problem
#1

[eluser]jupiter1031[/eluser]
I have a long page with a list of projects. After I go to a detail page I would like to return to the same project in the overview page and not on top of the page.
So with difficulties and with a combination of PHP and javascript I built a named anchor solution. This solution works in Chrome only but not in Firefox and IE.

Here are the code parts that make it work:
1) From single page go back to overview, I keep the anchor information in a cookie
Code:
<?php foreach ($records as $row) : ?>
     <a href="&lt;?php echo site_url('ge/projects_eng' )?&gt;">PROJECTS OVERVIEW</a> |
         &lt;?php   $this->session->set_userdata('hash',"a".$row->prj_index);  ?&gt;
    &lt;?php break ?&gt;
&lt;?php endforeach ?&gt;


2)
I overview I have a simple javascript that onload jumps to the named anchor on the page
Code:
function moveWindow()
    {
        window . location . hash="&lt;?php echo $this->session->userdata('hash')?&gt;";
    }
// this will create a variable "a13" for example
&lt;/head&gt;
&lt; body&gt; /* Your editor removed the onload part code - here I just have a simple body onload moveWindow() */

3)
The anchor looks like this:
Code:
<a name="a13"></a>



Why does this work only in one browser?
But my actual question is how do I get this to work in any browser?
Any other solutions I have not thought of?
Again what I really want is to come back to the place in my list from where I started.




Theme © iAndrew 2016 - Forum software by © MyBB