<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>编程狮(w3cschool.cn)</title>
</head>
<body>
<h2>JavaScript switch</h2>
<p id="demo"></p>
<script>
var text;
switch (new Date().getDay()) {
default:
text = "期待周末";
break;
case 6:
text = "今天是周六";
break;
case 0:
text = "今天是周日";
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>