logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 12-25-2009, 03:47 AM   #1
senator818
 
Join Date: Dec 2009
Posts: 3
Default Timed Image Swap

I'm trying to build a homepage where the main image automatically updates Bi-monthly. does anybody know of any scripts to do this(php or javascript)?

Having a heck of a time finding something simple, i'm not much of a scripter


Thanks in Advance,
Drew

Last edited by senator818; 12-25-2009 at 03:51 AM..
senator818 is offline   Reply With Quote
Old 12-27-2009, 01:02 AM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

Are they the same images every month?
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 12-27-2009, 01:16 AM   #3
senator818
 
Join Date: Dec 2009
Posts: 3
Default Timed Image Swap

yes
It is the main image that updates jan, march, may, july, sept, and nov.

I may have bit off more than I can chew, but.....

This is the script I am trying to work with....nothing seems to be happening?

Code:
<script>
// Function from http://www.developerfusion.co.uk/show/2310/
// used to create MultiDiension arrays quickly
function MultiDimensionalArray(iRows,iCols)
{
var i;
var j;
var a = new Array(iRows);
for (i=0; i < iRows; i++)
{
a[i] = new Array(iCols);
for (j=0; j < iCols; j++)
{
a[i][j] = "";
}
}
return(a);
}

function setDailyPic()
{
// Calendar Prep work
calendar = new Date();
day = calendar.getDay();
month = calendar.getMonth();
date = calendar.getDate();
year = calendar.getYear();
if (year < 1000)
year+=1900
cent = parseInt(year/100);
g = year % 19;
k = parseInt((cent - 17)/25);
i = (cent - parseInt(cent/4) - parseInt((cent - k)/3) + 19*g + 15) % 30;
i = i - parseInt(i/28)*(1 - parseInt(i/28)*parseInt(29/(i+1))*parseInt((21-g)/11));
j = (year + parseInt(year/4) + i + 2 - cent + parseInt(cent/4)) % 7;
l = i - j;
emonth = 3 + parseInt((l + 40)/44);
edate = l + 28 - 31*parseInt((emonth/4));
emonth--;

// Define new picture array and fill it
myPictureArray = MultiDimensionalArray(12,32); // Defines an array 0..11, 0..31
// January
myPictureArray[0][1]="/images/january.jpg";
//march
myPictureArray[3][1]="/images/march.jpg";
// may
myPictureArray[5][1]="/images/may.jpg";
//july
myPictureArray[7][1]="/images/july.jpg";
//sept
myPictureArray[9][1]="/images/september.jpg";
// nov
myPictureArray[11][1]="/images/november.jpg";
//test
myPictureArray[12][25]="/images/logo.jpg";


//month=0; day=26; // Uncomment this line to test

// Display Picture

var pictureSRC = (myPictureArray[month][date])?myPictureArray[month][date]:"/images/monthdefault.jpg";
document.getElementById("myPicture").setAttribute("src",pictureSRC);
}
</SCRIPT>

</HEAD>
<BODY onLoad="setDailyPic()">
<img id='myPicture' src='/images/monthdefault.jpg'></img>
</BODY>

What am I doing wrong??

is there something I need to set on the webserver??

Please help, this is the last open item I have on this website I have designed and I cant grasp what is going wrong.





site is at
http://www.rocklandtutoring.com/RM%20Music/



cheers!
Drew

Last edited by Corrosive; 12-27-2009 at 10:36 AM..
senator818 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:43 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com