window.location.href异常
JS语句:
function inquireInformation(option) { var value=option.value; alert(value); if(value=="student") { window.location.href="teacher_selectStudents.jsp"; } else if(value="teacher") { window.location.href="teacher_selectTeachers.jsp"; } else if(value="sc") { window.location.href="teacher_selectGrade.jsp"; } else if(value="allKeBiao") { window.location.href="teacher_selectAllKeBiao.jsp"; } else if(value="singleKeBiao") { window.location.href="teacher_selectSingleKeBiao.jsp"; } else{alert("hahah");} }
<select id="infomation" onChange="inquireInformation(this)"> <option>查询信息</option> <option value="student">查询全部学生信息</option> <option value="teacher">查询全部教师信息</option> <option value="sc">查询全部学生成绩</option> <option value="allKeBiao">查询全部课表</option> <option value="singleKeBiao">查询个人课表</option> </select>
function inquireInformation(option) { var value=option.value; alert(value); if(value=="student") { window.location.href="teacher_selectStudents.jsp"; } else if(value[color=#FF0000]=[/color]"teacher") { window.location.href="teacher_selectTeachers.jsp"; } else if(value[color=#FF0000]=[/color]"sc") { window.location.href="teacher_selectGrade.jsp"; } else if(value[color=#FF0000]=[/color]"allKeBiao") { window.location.href="teacher_selectAllKeBiao.jsp"; } else if(value[color=#FF0000]=[/color]"singleKeBiao") { window.location.href="teacher_selectSingleKeBiao.jsp"; } else{alert("hahah");} }
[解决办法]
else if(value="teacher")
[解决办法]
function inquireInformation(option)
{
var value=option.value;
alert(value);
if(value=="student")
{
window.location.href="teacher_selectStudents.jsp";
}
else if(value=="teacher")
{
window.location.href="teacher_selectTeachers.jsp";
}
else if(value="sc")
{
window.location.href="teacher_selectGrade.jsp";
}
else if(value=="allKeBiao")
{
window.location.href="teacher_selectAllKeBiao.jsp";
}
else if(value=="singleKeBiao")
{
window.location.href="teacher_selectSingleKeBiao.jsp";
}
else{alert("hahah");}
}