Results 1 to 5 of 5

Thread: Scheduled Content

  1. #1
    Join Date
    Dec 2008
    Location
    Moscow, Russia
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Scheduled Content

    Hello, I would like to find/make a JavaScript that loads content based on week of the year. Is that possible? Each piece of content is just a couple lines of text so it would be nice to keep it all in the same file. The script should check what week it is and display the content on a repeating annual schedule.

    Is this possible? If you have any suggestions/scripts/ideas please tell me!

    It must be JavaScript. I use .Mac/MobileMe web hosting and I don't think it does PHP.

    -MoscowModder

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    It depends how you define the week number, some years have 52 weeks, some have 53 and not all countries count them in the same way. Here are some scripts that calculate the week number in different ways:

    http://syn.ac/tech/19/get-the-weeknu...th-javascript/

    http://www.irt.org/script/914.htm
    Eddy Proca
    I love Dropbox. Get it through my girlfriend's referral link (I reached my limit) and both you and her get 500 MB extra! Thanks and you're welcome!

  3. The Following User Says Thank You to Snookerman For This Useful Post:

    MoscowModder (12-08-2008)

  4. #3
    Join Date
    Dec 2008
    Location
    Moscow, Russia
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default The Plan

    Thanks! I can add an iframe with a custom page (iWeb doesn't want me to tweak the head), and have it show a div with the id matching the week number. Right?

  5. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Yeah, I guess so. If you encounter any problems you can always come back here.
    Eddy Proca
    I love Dropbox. Get it through my girlfriend's referral link (I reached my limit) and both you and her get 500 MB extra! Thanks and you're welcome!

  6. #5
    Join Date
    Dec 2008
    Location
    Moscow, Russia
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default The first roadblock

    It has worked so far, but what I want it to do is show a <div> with the id matching the week number. Firebug tells me that "contentDiv is null". My code is this:

    Code:
    function showContent(){
    
    //Get the week number
    var divNumber = getWeek(y2k(now.getYear()),now.getMonth(),now.getDate());
    
    //Specify the container
    var contentDiv = document.getElementById(divNumber);
    
    //Show the container
    contentDiv.style.display='inline';
    }
    And later in the Body:

    Code:
    <script>showContent();</script>
    I clearly defined contentDiv as you can see, but it simply doesn't work. Any suggestions?

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
  •