function mweek()
{
var myweek =prompt("请输入:",1);//myweek表示星期几变量
switch(myweek)
{
case 1:
case 2:
document.write("学习理念知识");
break;
case 3:
case 4:
document.write("到企业实践");
break;
case 5:
document.write("总结经验");
break;
case 6:
case 7:
document.write("周六、日休息和娱乐");
}
}
</script>
</head>
<body>
<form>
<input type="button" value="点我啊" onclick="mweek()">
</form>
</body>
兄弟,prompt接收的是字符串,你需要给case中的1添个双引号。case “1”: 这样写就对了
prompt()接受的输入信息是字符类型,所以case接受的也必须是字符类型
one is a number and the other is a char , can't get matched!!!