SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: Avoiding frames

  1. #1
    SitePoint Zealot pacman2504's Avatar
    Join Date
    Oct 2003
    Location
    North Wales
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Avoiding frames

    I need to load a separate page within a page, that will also remain in place as the user navigates, but I want to avoid using frames?

    Would it be possible to do this within a <div> using CSS?

  2. #2
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could load an iframe into a hidden div and display it using Javascript.

    If you want the page to be permanently displayed, can you not just use a server-side include?


    Andy
    From the English nation to a US location.

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by awestmoreland
    use a server-side include
    This is the right answer, assuming your host allows you to do this.

  4. #4
    SitePoint Zealot pacman2504's Avatar
    Join Date
    Oct 2003
    Location
    North Wales
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but host does not support SSI. I am changing hosts anyway but need a short-term fix. I originally tried an inline frame but it won't take on the style of the div. I don't understand why I would need to hide the div, but would this overcome the positioning problem? And can you tell me where I can find the javascript code you mention?
    Thanks in advance.

  5. #5
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pacman2504
    Thanks, but host does not support SSI. I am changing hosts anyway
    Sounds as thought that's a wise move
    I originally tried an inline frame but it won't take on the style of the div.
    No, it wouldn't. You'd have to include a link to the same stylesheet from the page used as the source of the iFrame.
    I don't understand why I would need to hide the div
    The only reason that I suggested hiding it was because I was unsure from your original comments if you wanted it displayed the whole time or only when you clicked on a button or something. If you wanted to emulate changing a frame content using divs, then the simplest way is to have two divs - one hidden, one not - and switch the one that's displayed.
    can you tell me where I can find the javascript code you mention?
    After understanding your problem more, I don't think that Javacript's going to do you any good in this instance. If it's a short-term fix, why don't you simply cut and paste the code from the document you want to include directly into your main page?


    Andy
    From the English nation to a US location.

  6. #6
    SitePoint Addict
    Join Date
    Sep 2003
    Location
    Europe
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or you could try importing the other page by using the object tag.

  7. #7
    SitePoint Zealot pacman2504's Avatar
    Join Date
    Oct 2003
    Location
    North Wales
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but I don't think I've explained the situation particularly well (first post). I have one page on my site where I need to import an outsourced quote engine. An iframe would do the job, but I need to define its position, width and height properly.

    I can do this with inline declarations, but my HTML isn't then validated. Can this be done via my external CSS file, and if so, how?

  8. #8
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Easily. In your stylesheet:

    Code:
    .iframe {
    width: 300px;
    height: 200px;
    position: absolute;
    top: 20px;
    left: 200px;
    }
    In you HTML:

    Code:
    <iframe src="#" class="iframe"></iframe>

  9. #9
    SitePoint Zealot pacman2504's Avatar
    Join Date
    Oct 2003
    Location
    North Wales
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As simple as that? Thanks.


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
  •