Results 1 to 3 of 3

Thread: DIV source

  1. #1
    Join Date
    Apr 2012
    Posts
    63
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default DIV source

    Last question for my weblayout I hope

    dang it sucks to be a newb

    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

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    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.

  3. #3
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    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:
    Code:
    <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>
    <script>setTimeout('document.getElementById("div_menu").innerHTML=frames["iframe_menu"].document.documentElement.innerHTML',100)</script>
    </div>
    
    <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>
    <script>setTimeout('document.getElementById("div_content").innerHTML=frames["iframe_content"].document.documentElement.innerHTML',100)</script>
    </div>
    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.

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
  •