Alrighty, here's what I have. This isn't 100% tested mind you, as I didn't have 50 sites nor the amount of time it would take to FULLY test it. But, on the tests that were run, it worked beautifully.
Basically, instead of going by the day of the month, this uses the day of the year, essentially giving you a maximum of 365 different URLs you could use (366 on leap years, which, yes, it does check). And, it will loop itself continually, so after 50 items are done, it starts right back at number one.
It will work for any amount of items, so if that may change, simply put that number in where marked ('var itemNum='). Just make sure you have AT LEAST that number of URLs as well. Hopes it works for ya, Cheers.
-Minos
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>
Bookmarks