Ora e messaggio di Saluto, Ora e un messaggio diviso in quattro fasce orarie

« Older   Newer »
  Share  
Vale2
view post Posted on 14/4/2012, 09:01     +1   -1




Ciao,


uno script che visualizza lora e un messaggio.

I messaggi sono divisi in quattro fasce orarie:

Da Mezzanotte alle 05.59.59 - Buona Notte

Dalle 06.00 alle 11.59.59 - Buona Mattinata

Dalle 12.00 alle 18.59.59 - Buon Pomeriggio

Dalle 18.00 alle 23.59.59 - Buona Serata


CODICE
<script type="text/javascript">
var data=new Date()
hr=data.getHours()
if (hr >=00 && hr < 06)hr = " Buonanotte ";
if (hr >=06 && hr < 12)hr = " Buona Mattinata ";
if (hr >=12 && hr < 18)hr = " Buon Pomeriggio ";  
if (hr >=18 && hr < 24)hr = " Buona Serata ";
date=data.getDate()
h=data.getHours()
ms=data.getMinutes()
s=data.getSeconds()
if(ms<10)ms="0"+ms;
if(s<10)s="0"+s;
if(h<10)h="0"+h;
data=("<font face='Verdana' size='2' color='#000000'>Sono le ore "+h+":"+ms+":"+s+"<b>"+hr+"</b></font>");
document.write(data)
</script>


Valeria.



Edited by Vale2 - 15/4/2012, 13:31
 
Top
0 replies since 14/4/2012, 09:01   33 views
  Share