switch问题
javascript吧
全部回复
仅看楼主
level 2
柒月灬Love 楼主
2020年04月16日 07点04分 1
level 2
柒月灬Love 楼主
function Verify(){
var user = document.Login.user.value;
var pswd = document.Login.pswd.value;
var Vcode = document.Login.Vcode.value;
var Select = document.Login.Select.value;
alert(Select);
//var nw = open("admin/admin.html",user,"width=500,height=500");
//window.open("admin/admin.html",user,"width=500,height=500");
switch (Select){
case 0:
/*if(user != null){
if(user != 1040987915){
alert("您输入的账号错误!");
}else{
if(pswd != 123){
alert("您输入的密码错误!");
}else{
if(Vcode != code){
alert("您输入的验证码错误!");
}else{*/
window.open("admin/admin.html",user,"width=500,height=500");
/*}
}
}
}else{
alert("账号不能为空!");
}
break;*/
case 1:
/*if(user != null){
if(user != 2442963571){
alert("您输入的账号错误!");
}else{
if(pswd != 123){
alert("您输入的密码错误!");
}else{
if(Vcode != code){
alert("您输入的验证码错误!");
}else{*/
window.open("student/student.html",user,"width=500,height=500");
/*}
}
}
}else{
alert("账号不能为空!");
}
break;*/
case 2:
/*if(user != null){
if(user != 3130693860){
alert("您输入的账号错误!");
}else{
if(pswd != 123){
alert("您输入的密码错误!");
}else{
if(Vcode != code){
alert("您输入的验证码错误!");
}else{*/
window.open("teacher/teacher.html",user,"width=500,height=500");
/*}
}
}
}else{
alert("账号不能为空!");
}
break;*/
}
2020年04月16日 07点04分 2
level 2
柒月灬Love 楼主
<select name="Select">
<option value="0" style="width:80px">管理员</option>
<option value="1" style="width:80px">教师</option>
<option value="2" style="width:80px">学生</option>
</select>
var Select能拿到值
switch (Select)好像没有值
2020年04月16日 07点04分 3
level 12
switch 判断相当于 === 你获取值是字符串 你得加上双引号。。。 [乖]
case "0":
2020年04月16日 13点04分 5
1