<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>switch</title>
<script type="text/JavaScript">
function b(){
var myweek =document.getElementById("week").value;
//myweek表示星期几变量
switch(myweek)
{
case "1":
case "2":
document.write("学习理念知识");
break;
case "3":
case "4":
document.write("到企业实践");
break;
case "5":
document.write("总结经验");
case "6":
case "7":
document.write("周六、日休息和娱乐");
default:
alert("you are kidding me!")
}}
</script>
</head>
<body>
<div>情输入工作日:</div>
<input type="number" id="week" value=""/>
<input type="button" value="查看工作安排" onclick="b()"/>
</body>
</html>
5那可以没有,就会接着往下面执行,最后执行default,default需要break吧
case "6": case "7": document.write("周六、日休息和娱乐"); break;
少了个break;没有跳出,还是会执行default