Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2010
    Posts
    13
    Thanks
    6
    Thanked 0 Times in 0 Posts

    help with iframe

    Hello Experts

    I need your advice. I dont know if this is the write place to post my query. But I have an assignment due today. I have got everything working except an iframe that is driving me nuts.

    the question on the assignment asks to insert a command to write the HTML code
    <iframe src='weekday.htm'></iframe>
    to the webpage where weekday is the text string returned by the weekDay() function.

    The iframe should display the daily schedules that are stored in the sunday.htm through saturday.htm file.

    The weekDay() function is located in an external .js file that I have already linked to my webpage.

    Another thing is there is no weekday.htm file instead there are files sunday.htm through saturday.htm that have the daily schedules to de displayed in the iframe.

    I know that I should some link the weekday.htm file to the weekDay() function. This is what I have done so far:

    <h2 id="title">Today at the Union</h2>

    <p>
    <script type="text/javascript">
    /*
    Dispaly the daily schedule in an inline frame.
    Display schedules are stored in the files
    sunday.htm through saturday.htm
    */

    <iframe src='weekday.htm'>

    var weekday = weekDay();
    document.write(weekday);
    </iframe>
    </script>
    </p>

    Please advice as to how to get this thing working. I am not an expert( I am still learning.) I tried my best (spent several hours breaking my head on this). So any help is much appreciated.

    Thank you for your time
    Last edited by oliver-g; 04-06-2010 at 06:04 PM.

  • #2
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    you could try....

    Code:
    <script>
    function change_iframe()
    {
    var iframe = '<iframe src="' + weekDay() + '.html"></iframe>';
    document.getElementById("iframe_holder").innerHTML = iframe;
    }
    </script>
    
    <div id="iframe_holder"></div> <!-- This holds the iframe once it is created -->
    sorry i didn't answer sooner


  •  

    Posting Permissions

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