Click to See Complete Forum and Search --> : page of the day script


botz hall
07-03-2004, 07:44 PM
I'm looking for a script that will display a different page each day, I found this one but it doesn't work with opera, and that's what I need it to work with
Thanks


<script language="JavaScript1.2">

//Daily iframe content- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, and Terms Of use, visit http://dynamicdrive.com
//This credit MUST stay intact for use

var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1

//Specify IFRAME display attributes
var iframeprops='width=150 height=150 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"'

//Specify 7 URLs to display inside iframe, one for each day of week
var daycontent=new Array()
daycontent[1]="monday.htm" //Monday content
daycontent[2]="tuesday.htm" //Tuesday content
daycontent[3]="wednesday.htm"
daycontent[4]="thursday.htm"
daycontent[5]="friday.htm"
daycontent[6]="saturday.htm"
daycontent[0]="sunday.htm"

//No need to edit after here
if (ie||dom)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')

var mydate=new Date()
var mytoday=mydate.getDay()

function dayofweek_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=daycontent[mytoday]
}
}

window.onload=dayofweek_iframe

</script>

David Harrison
07-04-2004, 01:03 AM
This will not work in browsers with JavaScript disabled, therefore you should make sure that there is some content available for users with JavaScript disabled.<script type="text/javascript"><!--

var daycontent=new Array()
daycontent[0]="sunday.htm";
daycontent[1]="monday.htm";
daycontent[2]="tuesday.htm";
daycontent[3]="wednesday.htm";
daycontent[4]="thursday.htm";
daycontent[5]="friday.htm";
daycontent[6]="saturday.htm";

var today=new Date().getDay();

location.replace(daycontent[today]);

//--></script>

botz hall
07-04-2004, 07:10 AM
works like a charm, thanks a million

David Harrison
07-04-2004, 10:52 AM
Happy to help. :)