Results 1 to 3 of 3

Thread: Two daily iframe scripts on one page

  1. #1
    Join Date
    Oct 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Two daily iframe scripts on one page

    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?

  2. #2
    Join Date
    Oct 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default >> Solution <<

    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....

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    For future reference, linking to your page might be helpful.

    Glad you figured it out.

    And, yes, 10 year olds are smart.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •