By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,876 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,876 IT Pros & Developers. It's quick & easy.

How do I load a new page each day of the year?

P: n/a
There are plenty of scripts that load html into a page based on the
day of the week, month, or randomly, but I would like to load a
different page every day of the year.

I would like to give a script a list of 365 html pages and have it
load a new one into that page each day

Thanks in advance

Nov 11 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Nov 12, 12:33 am, nico...@sympatico.ca wrote:
There are plenty of scripts that load html into a page based on the
day of the week, month, or randomly, but I would like to load a
different page every day of the year.

I would like to give a script a list of 365 html pages and have it
load a new one into that page each day

Thanks in advance
What did you try yet. Come on, do something we can help you with, it's
not
that we are just waiting here for tasks to do. People can help, but it
shouldn't
be expected they do everything for you.

Cheers

Nov 12 '07 #2

P: n/a
On 11 Nov, 20:59, Darko <darko.maksimo...@gmail.comwrote:
On Nov 12, 12:33 am, nico...@sympatico.ca wrote:
There are plenty of scripts that load html into a page based on the
day of the week, month, or randomly, but I would like to load a
different page every day of the year.
I would like to give a script a list of 365 html pages and have it
load a new one into that page each day
Thanks in advance

What did you try yet. Come on, do something we can help you with, it's
not
that we are just waiting here for tasks to do. People can help, but it
shouldn't
be expected they do everything for you.

Cheers
Hi Darko,

You don't have to do anything at all and I really don't expect anyone
to do anything. I was just hoping that someone would read this and
know where I can find such a sript, perhaps they were in the same
situation that I'm in. I could have written down all the urls of the
search results I read through, but I didn't think that would help.

Nov 12 '07 #3

P: n/a
ni*****@sympatico.ca said the following on 11/11/2007 10:25 PM:
On 11 Nov, 20:59, Darko <darko.maksimo...@gmail.comwrote:
>On Nov 12, 12:33 am, nico...@sympatico.ca wrote:
>>There are plenty of scripts that load html into a page based on the
day of the week, month, or randomly, but I would like to load a
different page every day of the year.
I would like to give a script a list of 365 html pages and have it
load a new one into that page each day
That will break on Feb 29th every four years.
>>Thanks in advance
What did you try yet. Come on, do something we can help you with, it's
not
that we are just waiting here for tasks to do. People can help, but it
shouldn't
be expected they do everything for you.

Cheers

Hi Darko,

You don't have to do anything at all and I really don't expect anyone
to do anything. I was just hoping that someone would read this and
know where I can find such a sript, perhaps they were in the same
situation that I'm in. I could have written down all the urls of the
search results I read through, but I didn't think that would help.
I doubt you are going to find a ready made script for it. The simplest
way is to name all your files by the date. Use zero based month numbers
as that is what JS uses and it makes it simpler. Use getMonth() to give
you the month number, getDate() to give you the day of the month.

dayOfMonth = new Date().getDate()
monthOfYear = new Date().getMonth()
Now, you can follow Darko's advice. Give it a try, post your best attempt.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 12 '07 #4

P: n/a
On 11 Nov, 23:55, Randy Webb <HikksNotAtH...@aol.comwrote:
nico...@sympatico.ca said the following on 11/11/2007 10:25 PM:
On 11 Nov, 20:59, Darko <darko.maksimo...@gmail.comwrote:
On Nov 12, 12:33 am, nico...@sympatico.ca wrote:
>There are plenty of scripts that load html into a page based on the
day of the week, month, or randomly, but I would like to load a
different page every day of the year.
I would like to give a script a list of 365 html pages and have it
load a new one into that page each day

That will break on Feb 29th every four years.
>Thanks in advance
What did you try yet. Come on, do something we can help you with, it's
not
that we are just waiting here for tasks to do. People can help, but it
shouldn't
be expected they do everything for you.
Cheers
Hi Darko,
You don't have to do anything at all and I really don't expect anyone
to do anything. I was just hoping that someone would read this and
know where I can find such a sript, perhaps they were in the same
situation that I'm in. I could have written down all the urls of the
search results I read through, but I didn't think that would help.

I doubt you are going to find a ready made script for it. The simplest
way is to name all your files by the date. Use zero based month numbers
as that is what JS uses and it makes it simpler. Use getMonth() to give
you the month number, getDate() to give you the day of the month.

dayOfMonth = new Date().getDate()
monthOfYear = new Date().getMonth()

Now, you can follow Darko's advice. Give it a try, post your best attempt.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
Thanks Randy,

I hadn't thought of leap years. I was imagining that it would just
skip the last days of February in those years; which wouldn't matter
to me. Not every page has to be seen every year, the important part is
that a page is not repeated in a year.

Nov 12 '07 #5

P: n/a
Randy Webb wrote:
ni*****@sympatico.ca said the following on 11/11/2007 10:25 PM:
>On 11 Nov, 20:59, Darko <darko.maksimo...@gmail.comwrote:
>>On Nov 12, 12:33 am, nico...@sympatico.ca wrote:

There are plenty of scripts that load html into a page based on the
day of the week, month, or randomly, but I would like to load a
different page every day of the year.
I would like to give a script a list of 365 html pages and have it
load a new one into that page each day

That will break on Feb 29th every four years.
It will break in every leap year, which is not always every four years.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Nov 12 '07 #6

P: n/a
In comp.lang.javascript message <11**********************@c30g2000hsa.go
oglegroups.com>, Sun, 11 Nov 2007 15:33:15, ni*****@sympatico.ca posted:
>There are plenty of scripts that load html into a page based on the
day of the week, month, or randomly, but I would like to load a
different page every day of the year.

I would like to give a script a list of 365 html pages and have it
load a new one into that page each day
You'll have a problem next year, then.

Name the pages xxx1MMDD.htm, where xxx is anything reasonable, 1 is one,
MM is natural month, DD is day-of-month.

D = new Date()
Name = "xxx" + (10100 + D.getMonth()*100 + D.getDate()) + ".htm"
location.href = Name

Partially tested.
Uses local date.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 12 '07 #7

P: n/a
Thomas 'PointedEars' Lahn meinte:
Randy Webb wrote:
>That will break on Feb 29th every four years.

It will break in every leap year, which is not always every four years.
In won't make a difference in real life - given the year of the next
"exception"...

Gregor
--
http://www.gregorkofler.at ::: Landschafts- und Reisefotografie
http://www.licht-blick.at ::: Forum für Multivisionsvorträge
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Nov 12 '07 #8

P: n/a
Gregor Kofler said the following on 11/12/2007 1:55 PM:
Thomas 'PointedEars' Lahn meinte:
>Randy Webb wrote:
>>That will break on Feb 29th every four years.

It will break in every leap year, which is not always every four years.

In won't make a difference in real life - given the year of the next
"exception"...
Precisely :)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 12 '07 #9

P: n/a
In comp.lang.javascript message <11**********************@o38g2000hse.go
oglegroups.com>, Mon, 12 Nov 2007 03:59:05, ni*****@sympatico.ca posted:
>
I hadn't thought of leap years. I was imagining that it would just
skip the last days of February in those years; which wouldn't matter
to me. Not every page has to be seen every year, the important part is
that a page is not repeated in a year.
But it is, presumably, moderately important that the script behaves
without ostensible error on every day of every year, including when
there are 366 of them.

You did not actually say whether or not the same page should be shown on
the same "Gregorian" or ordinal date each year.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6.
Web <URL:http://www.merlyn.demon.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/- see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Nov 12 '07 #10

P: n/a
Dr J R Stockton wrote:

[]
>

There's no need to go that route in full for DoY :

function XDoY() { with (new Date()) {
var Y = getFullYear(), M = getMonth(), D = getDate() }
return 1001 + (Date.UTC(Y, M, D) - Date.UTC(Y, 0, 1))/864e5 }

This returns: 1307 (Saf2, FF2 Mac).
Is that what you are looking for?
Mick

Nov 13 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.