Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts

    sroll to a <a name> from parent to iframe

    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(){
    location.href="#toppage";
    {

    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?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,964
    Thanks
    0
    Thanked 236 Times in 233 Posts
    you keep on starting a new thread with the same problem...

    Read the forum rules first.

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,964
    Thanks
    0
    Thanked 236 Times in 233 Posts
    yes, but you did it twice..

    ok, try:

    function goUp(){
    location.href=location.pathname+"#toppage";
    }

    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, ..."

  • #5
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,964
    Thanks
    0
    Thanked 236 Times in 233 Posts
    So, have you tried the code I suggested in my last post?

  • #7
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Yes, it works now, thank you, that trick could be very useful for all who need to scroll into iframes.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •