PDA

View Full Version : Two daily iframe scripts on one page



alanross
10-20-2006, 03:42 PM
Script Title: Daily Iframe Content I / II

Script URL (on DD): http://dynamicdrive.com/dynamicindex17/dowiframe.htm

I'm trying to run two daily iframe scripts on the same page.... One provides content based on the day of the week, and a separate iframe provides content based on the day of the month. The two iframes are placed in separate cells on a table.

When testing the page, i discover that both scripts work fine when the opposing script is removed, but only one script will function when both are present.

To avoid conflicts, when pasting the second iframe script I added a '2' to each of the variable & function names so that no names would match those in the preceeding iframe script. (I also gave the iframes different names).
-any ideas what I'm missing?

alanross
10-21-2006, 12:29 AM
Here's the solution in case anyone else has the same problem:

1) Remove one of the scripts.
2) Create the second iframe pointing to an html page containing the second script, for example 'script2.html'.
3) Change the code in script2.html; remove everything except the credits and the daycontent array which lists a link page for each date, then add the following three lines:
var mydate=new Date()
var mytoday=mydate.getDate()
window.location = daycontent[mytoday]

-and that's it.

The answer was given to me by a ten year old....

djr33
10-21-2006, 12:33 AM
For future reference, linking to your page might be helpful.

Glad you figured it out.

And, yes, 10 year olds are smart. :D