View Full Version : sroll to a <a name> from parent to iframe

10-22-2003, 11:24 AM
Here's the situation

One parent with an iframe. In the iframe are calling, from menu, some pages. All those pages are long enough to need a button or something for client to be alble to go top of the page from a single click. I want to have that button on the parent page, but i want to scroll the pages in the iframe.

Now, I built a function, written in a JS file, SRC from each "child" pages:

function goUp(){

I want to call that function from within that button placed on the parent.

I tried with:

<a href="page1.html" target="farmename" onclick="top.frames['framename'].goUp()">

and it works so, but now I have two new problems:

1. This way I can not scroll but the page1.html, but I want that button to do the same for all pages, nomatter which is loaded in iframe
2. Even if I parse a variable, I still have to load the pages in iframe each time when I want to go top, but I want just to scroll, not to reload the page

I tried with

<a href="#" onclick="top.frames['framename'].goUp();return false">

and with

<a href="javascript:void(top.frames['framename'].goUp();return true)">

but it looks like the event open a new, undefined page, instead of simply scrolling up the page that is at the moment loaded in iframe. Any ideea?

10-22-2003, 11:41 AM
you keep on starting a new thread with the same problem (http://www.codingforums.com/showthread.php?s=&threadid=27885)...:mad:

Read the forum rules (http://www.codingforums.com/postguide.htm) first.

10-22-2003, 11:55 AM
I've told you that I pressed than the wrong button, so I decided now to express the whole problem again, there is no reason to be angry with me.

If you are moderator, then please remove the other threads with the same problem and leave this one please, as it is a newer and I have more chances to find an answer with this one... No offence, please, people do sometimes small mistakes, don't they?

10-22-2003, 12:14 PM
yes, but you did it twice..

ok, try:

function goUp(){

then in the parent:

<a href="#" onclick="top.frames['framename'].goUp();return false">

btw, what do you mean by this:

"but it looks like the event open a new, undefined page, ..."

10-22-2003, 12:36 PM
btw, what do you mean by this:

"but it looks like the event open a new, undefined page, ..."

opens a page which not exists. As if I would have gave a link to page.html, but there is no page.html file there

10-22-2003, 12:49 PM
So, have you tried the code I suggested in my last post?

10-23-2003, 09:51 AM
Yes, it works now, thank you, that trick could be very useful for all who need to scroll into iframes.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum