View Full Version : help with iframe

04-06-2010, 06:51 PM
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>

<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();

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

04-07-2010, 04:46 PM
you could try....

function change_iframe()
var iframe = '<iframe src="' + weekDay() + '.html"></iframe>';
document.getElementById("iframe_holder").innerHTML = iframe;

<div id="iframe_holder"></div> <!-- This holds the iframe once it is created -->

sorry i didn't answer sooner