Can I tweak the script below so that I could change.......

For system help, all hardware / software topics NOTE: use Coders Corner for all coders topics.

Moderators: Krom, Grendel

Post Reply
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Can I tweak the script below so that I could change.......

Post by thewolfe »

Can I tweak the script below so that I could change content for 9 days, 14 days, a month, etc?
<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>
User avatar
Mobius
DBB_Master
DBB_Master
Posts: 7940
Joined: Sun Jun 03, 2001 2:01 am
Location: Christchurch, New Zealand
Contact:

Post by Mobius »

It needs a little messing with - but yes - it's relatively easy. But I'm not doing it for you: programming without a proper scope is a waste of time.

Figure out *exactly* what you want it to do - and then come back.

You can't use 9, or 14 days though - unless the script gets re-written, because getDay() returns numerical value 0-6. You could use a different one for each day of the month - or a random one though.
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Post by thewolfe »

Mobius,

Dd you get my "private" message?

Thewolfe
Post Reply