Afiseaza data , ora si saluta ...
Pagina 1 din 1
Afiseaza data , ora si saluta ...
- Cod:
<script language="JavaScript" type="text/javascript">
<!--
// for all date displays
// http://scripturi.3xforum.ro/
today = new Date();
year = (today.getFullYear) ? today.getFullYear() : today.getYear();
month = today.getMonth();
switch (month) {
case 0 : month = "Ian"; break;
case 1 : month = "Feb"; break;
case 2 : month = "Mar"; break;
case 3 : month = "Apr"; break;
case 4 : month = "Mai"; break;
case 5 : month = "Iun"; break;
case 6 : month = "Iul"; break;
case 7 : month = "Aug"; break;
case 8 : month = "Sep"; break;
case 9 : month = "Oct"; break;
case 10 : month = "Noe"; break;
case 11 : month = "Dec"; break;
}
date = today.getDate();
day = today.getDay();
switch (day) {
case 0 : day = "Duminica"; break;
case 1 : day = "Luni"; break;
case 2 : day = "Marti"; break;
case 3 : day = "Miercuri"; break;
case 4 : day = "Joi"; break;
case 5 : day = "Vineri"; break;
case 6 : day = "Sambata"; break;
}
hours = today.getHours();
if (hours<12) greeting = 'Buna dimineata !';
if (hours<18 && hours>11) greeting = 'Buna ziua !';
if (hours<20 && hours>17) greeting = 'Buna seara !';
if (hours>19) greeting = 'Noapte buna! (working late ?)';
hour = (hours>12) ? (hours-12) : hours;
halfDay = (hours>11 && hours<24) ? 'PM' : 'AM';
minutes = today.getMinutes();
dayStr = day+ ', ' +date+ ' ' +month+ ', ' +year;
timeStr = (minutes<10) ? hour+ ':0' +minutes+ ' ' +halfDay : hour+
':' +minutes+ ' ' +halfDay;
// -->
</script>
<script language="JavaScript" type="text/javascript">
<!--
document.writeln('Astazi este ' +dayStr+ '.<br>Ora este: '
+timeStr+ '.<br>');document.write(greeting+ '<br>');
// -->
</script>
Pagina 1 din 1
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum