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?
| SitePoint Sponsor |

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?





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.
This is the right answer, assuming your host allows you to do this.Originally Posted by awestmoreland
![]()

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.





Sounds as thought that's a wise moveOriginally Posted by pacman2504
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 originally tried an inline frame but it won't take on the style of 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.I don't understand why I would need to hide the divAfter 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?can you tell me where I can find the javascript code you mention?
Andy
From the English nation to a US location.


Or you could try importing the other page by using the object tag.

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?
Easily. In your stylesheet:
In you HTML:Code:.iframe { width: 300px; height: 200px; position: absolute; top: 20px; left: 200px; }
Code:<iframe src="#" class="iframe"></iframe>

As simple as that? Thanks.
Bookmarks