[javascript]代码库
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>if判断结构</title>
</head>
<body>
<script type="text/javascript">
//var b = confirm("确定吗?");
var b = prompt("请输入值","");
var day = b;
if( 1 == day ){ //注意if(day = 1) 建议把常量写在前面
alert("星期一");
}else if( day == 2 ){
alert("星期二");
}else if( day == 3 ){
alert("星期三");
}else if( day == 4 ){
alert("星期四");
}else if( day == 5 ){
alert("星期五");
}else if( day == 6 ){
alert("星期六");
}else if( day == 7 ){
alert("星期日");
}else{
alert("错误的天数");
}
</script>
</body>
</html>