Results 1 to 5 of 5

Thread: Weekly Iframe Content Script

  1. #1
    Join Date
    Dec 2012
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Weekly Iframe Content Script

    Hello

    I'm looking for a script similar to theDaily Iframe Content script but that displays different content on a weekly basis

    I'm setting up a small website for a local sports league and want to display the fixtures for the forthcoming week. At the end of the season I just want to displat something like End of Season.

    Could anyone assist or point me in the direction of a script that could create this

    Many Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    </head>
    <body>
    <script type="text/javascript">
    
    //Weekly iframe content-  Dynamic Drive (www.dynamicdrive.com)
    //For full source code, and Terms Of use, visit http://dynamicdrive.com
    //This credit MUST stay intact for use
    
    Date.prototype.getWeek = function() {
     var onejan = new Date(this.getFullYear(),0,1);
     return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
     };
    
    //Specify IFRAME display attributes
    var iframeprops='width=150 height=150 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"'
    
    //Specify up to 53 (0 to 52) URLs to display inside iframe, up to one for each week of the year, less than 53 will be reused starting at 0
    // when they run out, the 53rd will only appear in years where there is a partial week left over at the end of the year (most years I think)
    var weekcontent=[];
    weekcontent[0]="0week.htm"
    weekcontent[1]="1week.htm"
    weekcontent[2]="2week.htm"
    weekcontent[3]="3week.htm"
    weekcontent[4]="4week.htm"
    weekcontent[5]="5week.htm"
    weekcontent[6]="6week.htm"
    
    //No need to edit after here
    document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')
    
    var mydate=new Date()
    var thisweek=(mydate.getWeek() - 1) % weekcontent.length;
    
    function dayofweek_iframe(){
    var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
    iframeobj.src=weekcontent[thisweek]
    }
    
    window.onload=dayofweek_iframe
    
    </script>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2012
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Many thanks,

    I presume weeklycontent[0] is week 1 and it then works forward

    Will give it a try but it appears that it will fit my requirement

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's right. How many different pages are you going to have? If you have 53, and they're numerically named in order, you won't have to list them in the code. If you're interested in that, let me know.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Dec 2012
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Many thanks for your help, all works well, just changed today

Similar Threads

  1. Multiple lessons subjects shown in weekly reminder
    By Jay Dog in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 01-16-2014, 02:45 PM
  2. Iframe SSI script II - Force css onto iframe content
    By cretin in forum Dynamic Drive scripts help
    Replies: 9
    Last Post: 04-15-2008, 08:34 AM
  3. Is there a "Weekly iframe content"-script?
    By Fizzgigg in forum Looking for such a script or service
    Replies: 5
    Last Post: 01-10-2008, 04:07 PM
  4. External content in Dynamic Ajax Content or Iframe SSI script II
    By halabar in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 04-30-2007, 05:11 PM

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
  •