Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Html "top" link targets

Options
  • 15-09-2004 3:30pm
    #1
    Closed Accounts Posts: 31


    Hi, i've been struggling with my fairly basic html knowledge to work out a problem I have with an iframe. Inside the iframe I have a series of links aimed at self (as in <a href="index.htm" target="_self">) with a number of pictures in each page.

    However I can't find a way to make the page move to the top of the iframe upon loading a new page into it (it's non-scrolling) to save someone haveing to drag the page back up everytime it's reloaded to new pictures, using _top (<a href="index.htm" target="_self">) just results in the page loading by itself, with no surrounding page and iframe, is there a way to combine the self and top targets? Or any other way around the problem that comes to mind?


Comments

  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Not really following you, but FYI you don't need to use TARGET unless you wish to load into another frame or window. The default is to load into the existing window.

    HTH,
    adam


  • Closed Accounts Posts: 31 phlebas


    Heh yeah, it is a little awkward to explain, it's likely simpler if I just link to it http://www.harlechhouse.com/gallery_page/overview_gallery.htm , containing the nine thumbnails is an iframe, with links inside it which load further sets of nine thumbnails, what I haven't worked out is how to get the browser to move to the top of the page when one of these is clicked, so that you don't have to scroll up to see the freshly loaded pictures from the top everytime you move page.


  • Moderators Posts: 6,862 ✭✭✭Spocker


    Just to make sure I have it right:
    phlebas wrote:
    containing the nine thumbnails is an iframe, with links inside it which load further sets of nine thumbnails, what I haven't worked out is how to get the browser to move to the top of the page when one of these is clicked, so that you don't have to scroll up to see the freshly loaded pictures from the top everytime you move page.

    Every time you click the 1-2-3-4 links you want the page contaning the thumbnails to "start" at the top.

    If this is the case then a bookmark is what you're after - a dummy anchor with just a name like so: <a name="topofpage"></a>. Add this to the top of every page (that contains the thumbnails). In your 1-2-3-4 links change to the following : .../overviewframe4.htm#topofpage and this will load your page in the iframe and position at the reference link - topofpage. You could just as easily use the same technique to position at the bottom etc etc.

    However I don't think this will move the containing page (everview_gallery.htm) because the only page your loading is directly into the iframe... I'll have a think about it and come back to you.....


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Ah, I getcha now. Ok, unless you have separate pages for each wee gallery, which will allow you to do it Spock's way, you're going to need a Javascript event handler to do two things at once. Like this:
    <a href="#top" onclick="location='http://www.harlechhouse.com/gallery_page/overviewframe2.htm'">2</a>
    
    BTW, you don't really need the "top" anchor, I'm pretty sure most browsers recognise it by default. You might want to check this though.

    adam


  • Moderators Posts: 6,862 ✭✭✭Spocker


    Yeah,

    I treid it out. There are seperate pages for each of the thumbnail galleries overviewframeX.html. If you add the empty anchor tag with the name and add this reference to each of your links it moves the page to the top of the iframe (not to the top of the containing page).

    Adams way works as well (your right about the 'top' being supported) so whichever method takes your fancy

    Good luck! :D

    P.S. I checked it in IE and Firefox so you *should* be OK for most browsers


  • Advertisement
  • Closed Accounts Posts: 31 phlebas


    Thanks alot for the replies, I had been looking at anchors but as you've both pointed out I wasn't sure how it would work with the surrounding frame. I've only been at this a few weeks and as a rank amateur had been avoiding pretty much anything but basic html but I guess it's time to start delving in javascript :p


    edit: sorry didn't see Spocks reply, that solves my problems perfectly I think, I thought the anchor wouldn't work inside the iframe, cheers :D


  • Closed Accounts Posts: 31 phlebas


    Just a quick question, does anyone know if external linking to anchors on pages (as in "/page.html#anchor") works with older browsers. It's just that it seems fine in Firefox/Mozilla and in safari on the Mac, but it doesn't seem to work for someone on OS9 using the last IE release for Mac, 5.2 I think it is.


  • Moderators Posts: 6,862 ✭✭✭Spocker


    It *should* - neither OS9 or IE5.2 are that old. Having said that I haven't worked on a Mac for years :o so perhaps someone else could help on that one....?


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    phlebas wrote:
    Just a quick question, does anyone know if external linking to anchors on pages (as in "/page.html#anchor") works with older browsers. It's just that it seems fine in Firefox/Mozilla and in safari on the Mac, but it doesn't seem to work for someone on OS9 using the last IE release for Mac, 5.2 I think it is.
    There's no reason why it wouldn't. Anchors are almost as old as the Internet (as we know it) itself. It shouldn't be an issue for any browser.


  • Closed Accounts Posts: 31 phlebas


    Yeah thanks for that, it seems you're right about the browser version being a non-issue at least, it's really odd, it'll work fine on a Windows machine running IE5, but not on a Mac running the same apparently (I swiped a friends OS9 laptop).


  • Advertisement
  • Registered Users Posts: 1,268 ✭✭✭hostyle


    phlebas wrote:
    Yeah thanks for that, it seems you're right about the browser version being a non-issue at least, it's really odd, it'll work fine on a Windows machine running IE5, but not on a Mac running the same apparently (I swiped a friends OS9 laptop).

    For Interet Explorer on Mac OS add:
    <a name="top"></a>
    

    somewhere at the top of teh page


Advertisement