Problem with inpage link

D

Darko

Hi,

I have a problem with <a name="..."></a>, <h2 id="...">...</h2>, or
whatever I put it like. This is the scenario:

I page 2.html, I have the following code:
<a name="video"></a>
<h2>Video</h2>

I would like to jump from page 1.html into 2.html, to location video.
So I put the code:
<a href="2.html#video">video</a>
into 1.html.

Now, these are just examples, actually it's help.php?
sec=mainPage#structure, but I hope that doesn't matter. The problem
is, when I click on the link "video" in 1.html, I get transferred to
2.html, but on the top of the page. The absurd thing is that now when
I'm on the top of this page, when I just focus on the address bar as
it is and press enter, it jumps into right position. What do I do
wrong?
 
R

rf

Darko said:
Hi,

I have a problem with <a name="..."></a>, <h2 id="...">...</h2>, or
whatever I put it like. This is the scenario:

I page 2.html, I have the following code:
<a name="video"></a>
<h2>Video</h2>

I would like to jump from page 1.html into 2.html, to location video.
So I put the code:
<a href="2.html#video">video</a>
into 1.html.

Now, these are just examples, actually it's help.php?
sec=mainPage#structure, but I hope that doesn't matter. The problem
is, when I click on the link "video" in 1.html, I get transferred to
2.html, but on the top of the page. The absurd thing is that now when
I'm on the top of this page, when I just focus on the address bar as
it is and press enter, it jumps into right position. What do I do
wrong?

1) Provide a URL that demonstrates the behaviour, or the misbehaviour, you
are experiencing.

2) Try to provide some coherant explanations of what your problem is.
 
D

Darko

1) Provide a URL that demonstrates the behaviour, or the misbehaviour, you
are experiencing.

2) Try to provide some coherant explanations of what your problem is.

I can't provide any address, since the site isn't published yet, and
it's inside our local network.

What does "coherant" mean? Did you mean coherent? :) Just kidding. I
don't know what else to say except for what I've already said. I show
you the source of both files and described the behaviour. What else?

I even thought my browser makes the problem, but it doesn't - for
other sites it works fine. I think it's just some sort of stupid
problem.
 
D

Darko

1) Provide a URL that demonstrates the behaviour, or the misbehaviour, you
are experiencing.

2) Try to provide some coherant explanations of what your problem is.

Yeah, it was stupid problem. I had a div that I put all the contents
into, and made that div display:none. When the page loaded, I made the
div visible so the user doesn't see elements arranging while the page
is not fully loaded. So, the Firefox probably tried to go to '#video'
the moment it got on the page, but it wasn't there until I showed the
div.

Thanks anyway
 
R

rf

Yeah, it was stupid problem. I had a div that I put all the contents
into, and made that div display:none. When the page loaded, I made the
div visible so the user doesn't see elements arranging while the page
is not fully loaded

WHAT?

I can only presume you make the div visible using javascript. That means
that the 10% or so of people who don't have javascript will never see your
div. Just like turning your server off for one month a year.

BTW coherant was a typo. We all make them sometimes. The polite people don't
notice them, except if they are in a web page up for review :)
 
J

Jonathan N. Little

For what it is worth, rather than use the named empty anchor, just set
the H2 element's ID to the fragment:

<h2 id="video">Video</h2>

then link <a href="2.html#video">video</a> should work. Why you are
currently having problem one can only guess because we cannot *see* what
you are doing....
 
D

Darko

WHAT?

I can only presume you make the div visible using javascript. That means
that the 10% or so of people who don't have javascript will never see your
div. Just like turning your server off for one month a year.

BTW coherant was a typo. We all make them sometimes. The polite people don't
notice them, except if they are in a web page up for review :)

Yes, I agree anyone who doesn't have javascript will not see my page,
but my page
is such that even if they *say* my div, not having javascript they
will have absolutely
no use of it, since the page uses around 160KB of javascript code.
It's aimed only at
people who have it, and if they turned it off they can turn it on, and
if they don't have
it then they can get it :)

The notice of the typo was just a joke.
 
D

Darko

For what it is worth, rather than use the named empty anchor, just set
the H2 element's ID to the fragment:

<h2 id="video">Video</h2>

then link <a href="2.html#video">video</a> should work. Why you are
currently having problem one can only guess because we cannot *see* what
you are doing....

Yes, I know, but as far as I can remember, some browsers (was it IE6?
I can't remember) had problems with just ids. So I ended with
giving both id and name to h2, if that won't work, I will make it
<a name="..."></a>
<h2 id="...">...</h2>

Hopefully that'll work. Thanks
 
B

Bergamot

Darko said:
Yes, I know, but as far as I can remember, some browsers (was it IE6?
I can't remember) had problems with just ids.

FYI, it was Netscape 4.x, a browser (thankfully) long dead and buried.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,197
Latest member
ScottChare

Latest Threads

Top