Jump to content


Photo

Random background


  • Please log in to reply
2 replies to this topic

#1 I am still lost

I am still lost

    Young Padawan

  • Members
  • Pip
  • 7 posts

Posted 06 January 2008 - 12:42 PM

I found a script on the net that changes the background on a web site every set time you have it to change....but what i want is it to change every 7th day...now i know just change the time it is set, but when you reload the page it goes back to the first photo

If you go to this link http://mytechworld.org/nto/

you will see it changes ever 60secs.....but if you refresh the page it goes back to the first photo...i dont want it to do that...i want to able to have 52 photos and they change every 7 days...I am really not that great with javascript. so any advie would be awesome

#2 Wildhoney

Wildhoney

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 08 January 2008 - 11:19 PM

Would that be something along the same lines as this?

#3 I am still lost

I am still lost

    Young Padawan

  • Members
  • Pip
  • 7 posts

Posted 16 January 2008 - 04:01 PM

Ok i got the radnom background issue resolved

[codebox]function takeYear(theDate) {

x = theDate.getYear();

var y = x % 100;

y += (y < 38) ? 2000 : 1900;

return y;

}



function getWeekNr()

{



var today = new Date();

Year = takeYear(today);

Month = today.getMonth();

Day = today.getDate();

now = Date.UTC(Year,Month,Day+1,0,0,0);

var Firstday = new Date();

Firstday.setYear(Year);

Firstday.setMonth(0);

Firstday.setDate(1);

then = Date.UTC(Year,0,1,0,0,0);

var Compensation = Firstday.getDay();

if (Compensation > 3) Compensation -= 4;

else Compensation += 3;

NumberOfWeek = Math.round((((now-then)/86400000)+Compensation)/7);

return NumberOfWeek;

}



var weekNum = getWeekNr();

var jpeg = '.jpg';

var picName = weekNum + jpeg; [/codebox]


But now i got another issue






Well the second part of the code isnt going correctly.....Well basicly the image backgroun will resize as the browser resizes...but i am wanting the background photo to stretch across the background..but changing any of those sizes will only make it bigger as in heoght even when i just change the width. so any ides would be great...i am running out of ideas lol. I have attached a .txt file with the full js script in it

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users