SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Frames with Anchors?

    Hi I'm having a bit of trouble and I wondered if anyone could help me with a solution.

    The situation is:
    I have a large table of data and throughout an online report when this table is mentioned a link is provided that opens the table and centers on the area of interest by an anchor (simple enough).

    A request has been made to make the titles to the columns visable at all times, so you dont have to scroll up and loose your place.

    So I created a frameset. In the top frame is the column titles and in the bottom frame is the information, so you can scroll through the table and can always see the column titles.

    The problem is, I can't figure out how to get the anchors working now, what I want is when I click the link the framed page opens the the bodyframe centers on the desired anchor location. How can I do this? or is there another (simple) way to go about this?

  2. #2
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In your frameset specify the name of the body frame (you may have already done so, but I'm going to say it again anyways).

    You can do so by using something like the following in your frameset tags:
    Code:
    <frameset cols="100%" rows="100,*">
    	<frame src="top_frame.htm" name="menu" />
    	<frame src="body_frame.htm" name="body" />
    </frameset>
    You'll notice that the frame is named body.

    Now, to get the anchors to work, utilize links like so:
    Code:
    <a href="body_page.htm#anchor_name_here" target="body">Anchor Link Blah</a>
    I apologize if I've stated any useless information (in that you may already know some of it), however, I hope it has been of some help.

    Basically you need to make use of the target="" attribute to let the browser know which window to load the relevant data (in this case your anchor declarations) in. Does that make any sense?

    -Colin
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  3. #3
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can also take a frameless route, if you wish. Take your top table row (<tr>) and use a fixed position to keep it on top. Use the CSS code:
    Code:
    tr#headers {
      position: fixed;
      top: 0;
      left: 0;  /* you may need to adjust this */
      width: 100%;  /* you may need to adjust this */
    }
    Now, give the row with the headers the ID headers (obvious). This method will work in Opera and NS versions six and up. IE still hasn't gotten around to implementing it and you can forget about NS4.

    But fret not! If you must get it to work in IE or worse, NS4, I'd suggest that you pickup some little DHTML script (you'll probably need to adapt it a bit) to supplement the CSS. :-)

    ~~Hope This Helps

  4. #4
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As elegant as Ian's suggestion may be, I feel I must reiterate my method for two reasons:
    1. Cross-broswer compatible & can be achieved w/ complete XHTML validity
    2. Much easier to implement than CSS or DHTML/JavaScript
    Now this is not to say Ian's method is bad; mine's just better.

    -Colin
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  5. #5
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Aes
    Now this is not to say Ian's method is bad; mine's just better.
    Puh-lese. My method is way more compatible!

    While it's true that a frame-based method will produce the same effect in slightly more browsers, those that don't support frames will see nothing! With this method, everyone will still have access to the information, even if they're browsing in IE3.

    Also, I thought the accessibility issues as well as the problems with search engines were already discussed thoroughly enough already on this forum. Using CSS and a shmere of well-implemented DHTML will degrade much, much better than the most carefully implemented frame-based approach.

    So take that and rub it in you Aes! :-p

    ~~Ian

  6. #6
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh pish posh Ian!
    Originally posted by Ian Glass
    ... My method is way more compatible! ... While it's true that a frame-based method will produce the same effect in slightly more browsers ...
    Perhaps I am mistaken, but am I the only one who detects two contradictory sentences there?
    Originally posted by Ian Glass
    ... those that don't support frames will see nothing! ...
    What modern browsers do not support frames? Oh, that's right, all of them do.
    Originally posted by Ian Glass
    Also, I thought the accessibility issues as well as the problems with search engines were already discussed thoroughly enough already on this forum. Using CSS and a shmere of well-implemented DHTML will degrade much, much better than the most carefully implemented frame-based approach.
    With a smidgeon of JavaScript, the search engine/frames issue can be considered dust in the wind.
    Originally posted by Ian Glass
    So take that and rub it in you Aes!
    After you, my dear Ian.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  7. #7
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Accessibility and compatibility aren't the same thing.
    To my understanding compatibility is a 'will it work?' issue (belt approach), whereas accessibility is more of a 'will the user still be able to get the content if it doesn't work?' issue (belt and braces approach) .
    The distinction is subtle, but in my opinion the distinction exists.

    (Disclaimer: But I could be wrong too)
    Last edited by Bill Posters; Mar 6, 2002 at 01:15.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  8. #8
    SitePoint Addict
    Join Date
    Jul 2001
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Aes
    Code:
    <a href="body_page.htm#anchor_name_here" target="body">Anchor Link Blah</a>
    shouldn't that be :
    Code:
    <a href="body_frame.htm#anchor_name_here" target="body">Anchor Link Blah</a>
    Just to be picky

  9. #9
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well it does need to work in IE so anything that doesnt work in IE isn't good for me (though that css code is pretty nice and simple)

    Now Aes just one thing that code is along the lines of what I am doing but.. the framed page is being called from a seperate page all together, and at the time the framed table may not even be open.
    by using

    <a href="body_frame.htm#anchor_name_here" target="body">

    wont it just open my body page by itself without the frameset?


Bookmarks

Posting Permissions

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