← Desenvolvimento

Imagem que muda consoante a hora!

Lida 5953 vezes

Offline

Tartaruga 
Membro
Mensagens 2908 Gostos 0
Troféus totais: 29
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2

Na sequência de um novo site que estou a fazer, uma das "mariquices" que gostava de lhe por era uma imagem que muda consoante a hora... ou seja sei que é só colocar um pequeno javascript mas eu não sei fazer sozinho e por isso peço ajuda a quem souber...

A ideia é quando o visitante entra no site aparecer uma imagem com "Bom dia" ou se ele entrar depois das 13 por exemplo que apareça outra imagem a dizer "Boa tarde".

Ideal era poder também colocar imagens a dizer "bom fim de semana" ou assim... mas isso será provavelmente mais complicado né?

Abraços!
Offline

frsantos 
Membro
Mensagens 1458 Gostos 0
Troféus totais: 35
Trófeus: (Ver todos)
Linux User Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter

boas conheço este
Código: [Seleccione]
<SCRIPT language=JavaScript>
    var d = new Date()
    var h = d.getHours()
   
ScrollSpeed = 100;
ScrollChars = 1;
           
function SetupTicker()

{if (h < 7)
      { msg = "                                     Passe uma Boa Noite!... na nossa companhia!...                                                                                              "; RunTicker();}

 else
    if (h < 12)
       { msg = "                                     Passe um Bom Dia!... na nossa companhia!...                                                                                              "; RunTicker();}

 else
    if (h < 20)
       { msg = "                                     Passe uma Boa Tarde!... na nossa companhia!...                                                                                              "; RunTicker();}

 else
       { msg = "                                     Passe uma Boa Noite!... na nossa companhia!...                                                                                              "; RunTicker();}
}
function RunTicker() {
window.setTimeout('RunTicker()', ScrollSpeed);
window.status = msg;
msg = msg.substring(ScrollChars) + msg.substring(0,ScrollChars); }
SetupTicker();

</SCRIPT>


penso k so tens de alterar o texto pela imagem

kt ao fim de semana
penso k so da se definires kuais os dias (1.2.3.4,...) a k calha o fim-de semana

aí definindo os dias podes fazer kk coisa tipo isto k fiz
abre a pagina 1 no dia 1 etc
http://www.tv-nacional.com/destaque/tv_info/destaque.php

mais n sei
Offline

Souza 
Elite
Mensagens 1816 Gostos 1
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

ha um tut mais completo no P@P  :wink: faz um search
Offline

Tartaruga 
Membro
Mensagens 2908 Gostos 0
Troféus totais: 29
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2

P@P ?
Offline

kingless 
Membro
Mensagens 857 Gostos 0
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Portugal a programar
Offline

asturmas 
Administrador
Mensagens 19734 Gostos 50
Feedback +2

Troféus totais: 39
Trófeus: (Ver todos)
Mobile User Windows User Super Combination Combination Topic Starter 100 Poll Votes 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

portugal-a-programar.org
Offline

Ricardo75 
Membro
Mensagens 1660 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Portugal-A-Programar.org
Offline

kingless 
Membro
Mensagens 857 Gostos 0
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Todos postaram ao mesmo tempo LOL  :lol:
Offline

Ricardo75 
Membro
Mensagens 1660 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

:lol:  :lol:  :lol:  :lol:  :lol:  :lol:  :lol:  :lol:  :lol:  :lol:  :lol:  :lol:  :lol:
Só almas caridosas o Tartaruga  :lol:  :lol:  :lol:
Offline

asturmas 
Administrador
Mensagens 19734 Gostos 50
Feedback +2

Troféus totais: 39
Trófeus: (Ver todos)
Mobile User Windows User Super Combination Combination Topic Starter 100 Poll Votes 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

Na eu postei em primeiro  :lol:
Offline

Tartaruga 
Membro
Mensagens 2908 Gostos 0
Troféus totais: 29
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2

Obrigado! :D:D:D
Offline

Souza 
Elite
Mensagens 1816 Gostos 1
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

lol sorry, erro meu :lol:
Offline

frsantos 
Membro
Mensagens 1458 Gostos 0
Troféus totais: 35
Trófeus: (Ver todos)
Linux User Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter

se encontrares deixa aki link :wink:
Offline

asturmas 
Administrador
Mensagens 19734 Gostos 50
Feedback +2

Troféus totais: 39
Trófeus: (Ver todos)
Mobile User Windows User Super Combination Combination Topic Starter 100 Poll Votes 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

_JcR_, bem vindo ao mais trafego
Mas sabes como fazer isso com imagens?