Hello Reader's! If you want to change your web background image automatic on the day time basis, i.e. for day it will show pic 1 and in night it will show pic 2 as background.
Lets see the full example below:-
</body>
<script type="text/javascript">
var currentTime = new Date().getHours();
if (7 <= currentTime && currentTime < 20) {
if (document.body) {
document.body.background = "http://itsnotch.com/tumblr/images/daytime_bg.jpg";
}
}
else {
if (document.body) {
document.body.background = "http://itsnotch.com/tumblr/images/nighttime_bg.jpg";
}
}
</script>
</html>
0 Comment(s)