- Cod:
<script type="text/javascript">
var d=new Date();
var theDay=d.getDay();
switch (theDay)
{
case 0:
document.write("<b>Sleepy Sunday!!</b>");
break;
case 1:
document.write("<b>The hell with the school!!Stay here and chat!!</b>");
break;
case 2:
document.write("<b>The hell with the school!!Stay here and chat!!</b>");
break;
case 3:
document.write("<b>The hell with the school!!Stay here and chat!!</b>");
break;
case 4:
document.write("<b>The hell with the school!!Stay here and chat!!</b>");
break;
case 5:
document.write("<b>Finally weekend!!</b>");
break;
case 6:
document.write("<b>Sunny Saturday!!</b>");
break;
default:
document.write("<b>I'm really looking forward to this weekend!</b>");
}
</script>
in functie de ziua respectiva acest script va arata diferite fraze
tinem cont ca sunday=0 monday=1 etc
observam functia: "if" este sunday atunci "print" "Sleepy Sunday"
si asa mai departe
trebuie doar introdusa in pagin web