#top

Josh Simpson's picture

They have: 147 posts

Joined: Dec 1999

I was wondering how to send you to the top of the page
I know it is normaly done by http://www.somthing.com/index.htm#top
or whatever.

What I want to know is how to send you to the top of a page from a link in another frame?

JLS (Joshua Lee Simpson)

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Or, more specifically,

link

in the frame and this will empty the window of the frameset and load the url of the new page (page.html in this case) into the window.

If you are not looking to clear the frameset, but want to go to the top of a document in the main frame from a link in any other frame, you would use:

link

or

link

I should point out that you should have at the top of your pages if you want to have the code validate (and therefore work properly in the more advanced browsers).

Regardless, without more details, that's as much information as I can give you.

hth,

Smiling Suzanne

Josh Simpson's picture

They have: 147 posts

Joined: Dec 1999

Sorry for not being more specific.

I relise how the "#top" works.

I have 4 frames Laughing out loud

I have one general navigation bar in a frame for all pages. This has things like

refresh content frame
Sent content frame to main page

what I want is a script that will send you to the top of the conetent frame, regardles of what page is actualy loaded into the content frame.

I hope this explanes better. Smiling

I have this code is is what I need?
or somthng similar?

<script>
function PageTop() {
var s;
s = parent.content.location.href;
parent.content.location="s+'#Top'";
}
</script>
'

JLS (Joshua Lee Simpson)

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

'k, I'm totally missing your problem -- if you call a new document into a frame, it should automatically load to the very top of the page (the document should be right at the top, with a scrollbar in the frame if necessary).

Can you offer up the url so I can see what the problem is?

Also, I added the bit about #top because without the actual on the page, Netscape 6 will no longer do anything. Previous browsers snapped to the top if there was no target found.

Regardless, the #internaltarget is part of the href or link, so shouldn't have to be set differently.

I can't even think of what you could be doing to get the page loading not at the top of the page.

Suzanne

Josh Simpson's picture

They have: 147 posts

Joined: Dec 1999

All I want to do is have a to the top button

But insted of having the link on the same page, i want it on a different page in a different frame.

the page does load at the top but i want it so if you scroll down the page, you just click the "top" buton in the navigation frame,

This brings in the problem of that the top comand has to work regardless of what page is actualy loaded.

Do you get what I mean now?

Have a look

http://redrival.com/jls/temp2/

scroll the main fram down and then click on the little yellow arrow down the bottom of the page i want it to make the page you just scrolled go to the top again, rember that the page that you scrolled can be a number of pagers from my site.

JLS (Joshua Lee Simpson)

Josh Simpson's picture

They have: 147 posts

Joined: Dec 1999

I dont know why it wasent working but i have this script now iad it works exactily how i wanted. Laughing out loud

function gototop()
{
var s,h;
s = parent.content.location.href;
h = s.lastIndexOf("#");
if (h < 0) {parent.content.location.href = s + "#Top"}
else {parent.content.location.href = s.substring(0,h) + "#Top"}
}
'

Thanks for you help Suzanne

Even though I dident find out from you how to do it, i learnt somthing else

"_top" thanks for that i was wondering how that worked Smiling

JLS (Joshua Lee Simpson)

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Thanks for explaining what you meant! Now that I see what you are doing, of course, it's very clear. (Isn't that always the case?)

Glad you got it working, congratulations! You probably feel a million miles taller for working it out, too (I always do, much to the annoyance, I am sure, of my coworkers who aren't used to a woman whooping when she has a break through!)

Cheers!

Smiling Suzanne

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.