View Full Version : DIV source

05-08-2012, 08:15 AM
Last question for my weblayout I hope :o

dang it sucks to be a newb :mad:

I've got these 2 divs, one for the menu, one for the content.
Now...the site that i have online, has Iframes inside its divs to show the html page that contains the menu and the content stuff, but on for example a phone (which does not support Iframes, and thus the website looks really ugly) I want something else to make up for the Iframes.
Ofcourse basically everything supports DIVs, so I was wondering if I could assign a source code to the Div, so the sourcepage will be directly displayed in the DIV.

Ive tried <div src="menu.html" id="menu"> basically the same as you would do with an iframe
But this wont display the external html file...

Is there a way to fix this OR a way to use something else thatll do this.
As long as I get rid of the Iframes I'm happy :D

05-08-2012, 01:40 PM
To answer your specific question: no.

Use a server-side language (like PHP) to include all the parts of your page when it's served.

05-08-2012, 11:25 PM
Something like the following works. The content of the iframes is written to the divs. The 'sources' of the divs will be identical to the sources of the iframes:

<div id="div_menu" style="position: absolute; left:5%;top:10%; width:10%;bottom:10%; border: 1px solid red">
<iframe name="iframe_menu" src="iframe_menu.html" style="position:absolute;left:-10000px" ></iframe>

<div id="div_content" style="position: absolute; left:15%;top:10%; width:80%;bottom:10%; border: 1px solid red">
<iframe name="iframe_content" src="iframe_content.html" style="position:absolute;left:-10000px" ></iframe>

But this may be a risky solution, as we don't know in advance how much timeout we need.
Of course, if the iframed pages contain styles and scripts, we must put them in the main page.
Arie Molendijk.