Results 1 to 8 of 8

Thread: Message for day in the year

  1. #1
    Join Date
    Jan 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Message for day in the year

    Hello,

    I am looking forward for DD Script that could display different messege depend on the day in the year (not day of week or month).

    I realy appreciate your help.

    Thanks in advanced,
    Tal

  2. #2
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    Not only is it possible, I've already done it. The only thing is...I'm not entirely sure why you'd want 365 different messages. So, nonetheless, this will work for ANY amount of days up to 365.

    Code:
    <script type="text/javascript">
    
    /***********************************************
    * Daily iframe content II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    * Modified by Nick Faiola to allow +31 URLs
    ***********************************************/
    //Number of Items
    var itemNum=31
    
    var ie=document.all
    var dom=document.getElementById
    
    //Specify IFRAME display attributes
    var iframeprops='width=300 height=300 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"'
    
    //Specify 'itemNum' URLs to display inside iframe, one for each day of the current month
    //If this month has less than 31 days, the last few URLs won't be used.
    var content=new Array()
    content[1]=""
    content[2]=""
    content[3]=""
    content[4]=""
    content[5]=""
    content[6]=""
    content[7]=""
    content[8]=""
    content[9]=""
    content[10]=""
    content[11]=""
    content[12]=""
    content[13]=""
    content[14]=""
    content[15]=""
    content[16]=""
    content[17]=""
    content[18]=""
    content[19]=""
    content[20]=""
    content[21]=""
    content[22]=""
    content[23]=""
    content[24]=""
    content[25]=""
    content[26]=""
    content[27]=""
    content[28]=""
    content[29]=""
    content[30]=""
    content[31]=""
    
    //No need to edit after here
    var months=new Array(31,28,31,30,31,30,31,31,30,31,30,31)
    
    if (ie||dom) document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')
    
    var mydate=new Date()
    var myMonth=mydate.getMonth()
    var myToday=mydate.getDate()
    var myYear=mydate.getYear()
    var dateOfYear=0
    
    function isLeapYear(year){
     if (year%4!=0) return false
     if (year%100==0){
      if (year%400==0) return true
      return false
     }
     return true
    }
    
    function dayOfYear(){
     for (i=0;i<myMonth;i++)
        dateOfYear+=months[i]
     dateOfYear+=myToday
     if (myYear<1000) myYear+=1900
     if (isLeapYear(myYear) && myMonth > 1) dateOfYear++
     dateOfYear=(dateOfYear%itemNum!=0)? dateOfYear%itemNum : itemNum
     return dateOfYear
    }
    
    
    function dayofmonth_iframe(){
     if (ie||dom){
      var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
      iframeobj.src=content[dayOfYear()]
     }
    }
    
    window.onload=dayofmonth_iframe()
    </script>
    Verzeihung!

  3. #3
    Join Date
    May 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Hello, i saw the change you made and is great, so i ask you if you think its possible to change this daily iframe content to change every week, for example, every Monday. In this case, what i need is the script change the iframe content every Monday of the year, so that is 53 changes along the year.

    Thanks in advance and gr8 job and site.

  4. #4
    Join Date
    May 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i've tried to use this script with the "day of year" change, and like i said before i wanted to the content change weekely (every 7 days or every Monday for example), so i gave the same url to days 1/2/3/4/5/6/7 and another different to the days 8/9/10/11/12/13/14 and so on , and it hadn't work for me.

    Please, need help with this, i will appreciate it very much
    Thanks

  5. #5
    Join Date
    Jun 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Minos
    Not only is it possible, I've already done it. The only thing is...I'm not entirely sure why you'd want 365 different messages. So, nonetheless, this will work for ANY amount of days up to 365.
    I'm particularly interested in how this works. i.e. I have 365 pages that I need displayed on the appropriate days but I see only places for 31 urls. Obviously I'm missing something... which isn't surprising since I am a total newbie at this.

    Any help would be much appreciated

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

    Default Daily iframe content II / center images?

    this code is cool!


    how can i get the images to load centered to page?

    here?
    //Specify IFRAME display attributes
    var iframeprops='width=1024 height=600 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"'


    or here?
    content[1]="1.htm"

    thank you.

  7. #7
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Quote Originally Posted by threeflip
    this code is cool!


    how can i get the images to load centered to page?

    here?
    //Specify IFRAME display attributes
    var iframeprops='width=1024 height=600 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"'


    or here?
    content[1]="1.htm"

    thank you.
    When posting another question, please start a new thread.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  8. #8
    Join Date
    Dec 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I have been hunting for a script that would display a quote for each day of the year as this forum is discussing. I noticed the last entry about itsays that Dalarian would like to know more about how it works. II would like to know if I can set it up to read an external text file or database,.

    Can some continue with this discussion? I have a calendar of quotes that I would like to put up in a popup window that shows the date and the quote for that day. I was requested by a customer to do this for the visitors that are blind and need there computer to talk to them.

    Would it be better to do this using a database and pphp? If so, can you point me to the place I need to go to learn this trick?

    Any help would be very much appriciated.

    Thanks, Rick

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
  •