top



Code:
<script language="JavaScript">



day=new Date()    //..get the date



x=day.getHours()    //..get the hour



if(x>=0 && x<3) {





  document.write('<style type="text/css">body{background: white url(...εδώ το url της εικόνας που θα εμφανίζετε  00:00 - 03:00 .....); color: blackbackground-position: center; background-repeat: no-repeat; background-attachment: fixed; }</style>')

} else



if(x>=3&& x<8) {





  document.write('<style type="text/css">body{background: white url(...εδώ το url της εικόνας που θα εμφανίζετε  03:00 -08:00  .....); color: blackbackground-position: center; background-repeat: no-repeat; background-attachment: fixed; }</style>')

} else



if(x>=8 && x<12) {





  document.write('<style type="text/css">body{background: white url(...εδώ το url της εικόνας που θα εμφανίζετε  08:00-12:00  .....); color: blackbackground-position: center; background-repeat: no-repeat; background-attachment: fixed; }</style>')

} else



if (x>=12 && x<18) {



  document.write('<style type="text/css">body{background: white url(...εδώ το url της εικόνας που θα εμφανίζετε  12:00 - 18:00 .....); color: blackbackground-position: center; background-repeat: no-repeat; background-attachment: fixed; }</style>')







} else

if (x>=18 && x<22) {






 document.write('<style type="text/css">body{background: white url(...εδώ το url της εικόνας που θα εμφανίζετε  18:00-22:00  .....); color: blackbackground-position: center; background-repeat: no-repeat; background-attachment: fixed; }</style>')







} else

if (x>=22 && x<24) {






 document.write('<style type="text/css">body{background: white url(...εδώ το url της εικόνας που θα εμφανίζετε  22:00-24:00  .....); color: blackbackground-position: center; background-repeat: no-repeat; background-attachment: fixed; }</style>')

}
</script>



I have this code that just needs to put it to worked? pliss help

What you trying to do?

to automatically change the background depending on time...

Did you change
...εδώ το url της εικόνας που θα εμφανίζετε 12:00 - 18:00 ..... to your background that you want

Code:
εδώ το url της εικόνας που θα εμφανίζετε 12:00 - 18:00
Here enters the picture ... but to add the code to work

There is a much easier way to do that ..

Code:
<script type="text/javascript">
onload = function () {

var day=new Date();
var x=day.getHours();
var y=document.body.style;

if (x>=0 && x<3) { //Time from 00.00 to 03.00
y.background="url('URL TO IMG HERE')";
}
else if (x>=3 && x<8) { //Time from 03.00 to 08.00
y.background="url('URL TO IMG HERE')";
}
else if (x>=8 && x<12) { //Time from 08.00 to 12.00
y.background="url('URL TO IMG HERE')";
}
else if (x>=12 && x<18) { //Time from 12.00 to 18.00
y.background="url('URL TO IMG HERE')";
}
else if (x>=18 && x<22) { //Time from 18.00 to 22.00
y.background="url('URL TO IMG HERE')";
}
else { //Time from 22.00 to 24.00
y.background="url('URL TO IMG HERE')";
}

}
</script>

and how I put this script ? exactly?

Where do you want it?

You can remove the tags from the code I gave you, and go to ACP -> Modules -> HTML & Javascript -> Javascript code management -> Create a new Javascript, where you paste it in and choose "In all pages". Smile

mm no work.. :( (version phpBB2 )

can someone help me? Don\'t Cry

Remove the script tags.