PDA

View Full Version : Message for day in the year



talsh
01-26-2005, 09:39 AM
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

Minos
01-26-2005, 06:11 PM
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.



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

MULITRI
05-23-2005, 09:12 PM
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.

MULITRI
06-04-2005, 02:32 PM
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

Dalriadan
06-04-2006, 10:36 PM
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 :)

threeflip
10-08-2006, 11:03 PM
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.

tech_support
10-09-2006, 04:08 AM
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.

RSoldin
12-18-2006, 09:23 PM
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