<script>
function myFunc() {
var day;
switch (new Date().getDay()) {
case 0: day = "Sunday";
break;
case 1: day = "Monday";
break;
case 2: day = "Tuesday";
break;
case 3: day = "Wednesday";
break;
case 4: day = "Thursday";
break;
case 5: day = "Friday";
break;
case 6: day = "Saturday";
break;
default: day = "Undefined Day";
}
document.getElementById("result").innerHTML = "Today is " + day;
}
</script>
//getDay()方法以0到6之间的数字返回工作日。