/    Sign up×
Community /Pin to ProfileBookmark

time of day picture change

Hello in the tutorial time of day picture change i want to help me because i dont know javascript. I do everything you say here [URL=”http://javascript.internet.com/time-date/time-of-day-picture-change.html”]http://javascript.internet.com/time-date/time-of-day-picture-change.html[/URL]
My problem is that i want to change 3 photo not only 2 and the last is if you can tell me how to and time not just 3 or 7 o’clock but let say 3:39 is it possible.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Jul 06.2010 — Yes it is. t.getMinutes() is the minutes and you just have to change the if statement. Might be easier to understand like this.if (h >= 7 && h < 17) {
el.src = "between 7 am and 5 pm.gif";
}
if (h >= 17 || < 7) {
el.src = "not between.gif";
}
Copy linkTweet thisAlerts:
@dj_kostas_proauthorJul 06.2010 — Ok i add this you say but in breamweave they give me error in the last line can you help me ?

And the other for minutes where i must put this code.

Sorry for ascing all this but as i sayed i dont know javascript


[CODE]function pixTimeChange() {
var t=new Date();
var h = t.getHours();
var r1="Logo.jpg";
var r2="3D.jpg";
var el=document.getElementById('myimage');



if (h >= 7 && h < 17) {
el.src = "between 7 am and 5 pm.gif";
}
if (h >= 17 && h < 7) {
el.src = "not between.gif";
}



function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}

addLoadEvent(function() {
pixTimeChange();
});[/CODE]
Copy linkTweet thisAlerts:
@Declan1991Jul 06.2010 — function pixTimeChange() {
var t=new Date();
var h = t.getHours();
[B] var m = t.getMinutes();[/B]
var r1="Logo.jpg";
var r2="3D.jpg";
[B] var r3 = "something.jpg";[/B]
var el=document.getElementById('myimage');
if (h &gt;= 7 &amp;&amp; h &lt; 17) {
el.src = "between 7 am and 5 pm.gif";
}
if (h &gt;= 17 &amp;&amp; h &lt; 7) {
el.src = "not between.gif";
}
[B][COLOR="Red"]}[/COLOR][/B]
http://www.echoecho.com/javascript6.htm

You should be able to follow that.

If you try something and you don't know why it doesn't work, ask here.
×

Success!

Help @dj_kostas_pro spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...