<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>switch</title>
<script type="text/JavaScript">
function a(){
//myweek表示星期几变量
var myweek=3;
myweek=prompt("ssss",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("周六、日休息和娱乐");
break;
}
}
</script>
</head>
<body>
<input name="button" type="button" onclick="a()" value="请输入星期几">
</input>
</body>
</html>
switch( parseInt( myweek ) )
<input name="button" type="button" onclick="a()" value="请输入星期几">
按钮设置没有</input>
switch( parseInt( myweek ) )
switch( Number( myweek ) )
prompt()返回的是字符串,你可以把case 1:中的1换成“周一”或“1”(用引号把1引上),就可以了
同求答案
当我没说好了,题目没看清
用法错误,去掉prompt第二个参数