求高手指点 jsp radio问题,在线等,谢谢
<html><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/><title>...
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>学生管理系统</title>
<link href="css/first.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
<!--
.STYLE6 {font-size: large}
-->
</style>
<script language="javascript">
function zhuce(){
window.open('注册页面.html');
}
function laoshi(){
var laosh = document.getElementById("radio1");
//var xueshen = document.getElementById("radio2");
var yonghuming1 = document.getElementById("yonghuming");
var mima = document.getElementById("mima");
if((laosh.checked)&&(yonghuming1.value=="laoshi")&&(mima.value==123)&&(laosh.value=="老师")){
window.open("teacher/登陆成功.html");
}
else if((laosh.checked==true)&&(yonghuming1.value=="xuesheng")&&(mima.value==321)&&(laosh.value=="学生")){
window.open("student/学生登陆成功.html");
}else
window.open("登陆失败.html");
}
</script>
</head>
<body>
<table width="465" height="294" border="0" align="center">
<tr>
<th width="80" height="32" scope="row"> </th>
<td width="375"><span class="STYLE4">学生管理系统</span></td>
</tr>
<tr>
<th scope="row"> </th>
<td bordercolor="#ECE9D8"><p> </p>
<form id="form2" name="form2" method="post" action="">
<input type="radio" name="radio1" value="老师" id="radio1" />
<label for="radio"></label>
<span class="STYLE4 STYLE6">老师</span>
<input type="radio" name="radio1" value="学生" id="radio1" />
<span class="STYLE4 STYLE6">学生</span>
</form>
<form id="form3" name="form3" method="post" action="">
<label for="radiobutton"></label>
<span class="STYLE4 STYLE6">用户名</span>:
</form>
<table width="156" border="0" bordercolor="#000000">
<tr>
<input style="background:#99FFFF"name="yonghuming" type="text">
</tr>
</table>
<p><span class="STYLE4 STYLE6">密码</span>:</p>
<table width="156" bordercolor="#000000">
<tr>
<input style="background: #99FFFF"name="mima" type="password" maxlength="10">
</tr>
</table>
<form name="form1" method="post" action="">
<label for="Submit"></label>
<input name="Submit" type="submit" id="Submit" onClick="zhuce()" value="注册">
<label for="label"></label>
<input type="submit" name="Submit2" value="登陆" id="label" onClick="laoshi()">
</form>
</font></tr>
</table>
</body>
</html>
我想要在选择学生的时候如果用户名跟密码正确的时候进入学生页面,但是现在这个问题是,只能进入老师的页面,不能进入学生的,虽然加了value属性加以区分,但是还是不可以,高手指点下,谢谢 展开
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>学生管理系统</title>
<link href="css/first.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
<!--
.STYLE6 {font-size: large}
-->
</style>
<script language="javascript">
function zhuce(){
window.open('注册页面.html');
}
function laoshi(){
var laosh = document.getElementById("radio1");
//var xueshen = document.getElementById("radio2");
var yonghuming1 = document.getElementById("yonghuming");
var mima = document.getElementById("mima");
if((laosh.checked)&&(yonghuming1.value=="laoshi")&&(mima.value==123)&&(laosh.value=="老师")){
window.open("teacher/登陆成功.html");
}
else if((laosh.checked==true)&&(yonghuming1.value=="xuesheng")&&(mima.value==321)&&(laosh.value=="学生")){
window.open("student/学生登陆成功.html");
}else
window.open("登陆失败.html");
}
</script>
</head>
<body>
<table width="465" height="294" border="0" align="center">
<tr>
<th width="80" height="32" scope="row"> </th>
<td width="375"><span class="STYLE4">学生管理系统</span></td>
</tr>
<tr>
<th scope="row"> </th>
<td bordercolor="#ECE9D8"><p> </p>
<form id="form2" name="form2" method="post" action="">
<input type="radio" name="radio1" value="老师" id="radio1" />
<label for="radio"></label>
<span class="STYLE4 STYLE6">老师</span>
<input type="radio" name="radio1" value="学生" id="radio1" />
<span class="STYLE4 STYLE6">学生</span>
</form>
<form id="form3" name="form3" method="post" action="">
<label for="radiobutton"></label>
<span class="STYLE4 STYLE6">用户名</span>:
</form>
<table width="156" border="0" bordercolor="#000000">
<tr>
<input style="background:#99FFFF"name="yonghuming" type="text">
</tr>
</table>
<p><span class="STYLE4 STYLE6">密码</span>:</p>
<table width="156" bordercolor="#000000">
<tr>
<input style="background: #99FFFF"name="mima" type="password" maxlength="10">
</tr>
</table>
<form name="form1" method="post" action="">
<label for="Submit"></label>
<input name="Submit" type="submit" id="Submit" onClick="zhuce()" value="注册">
<label for="label"></label>
<input type="submit" name="Submit2" value="登陆" id="label" onClick="laoshi()">
</form>
</font></tr>
</table>
</body>
</html>
我想要在选择学生的时候如果用户名跟密码正确的时候进入学生页面,但是现在这个问题是,只能进入老师的页面,不能进入学生的,虽然加了value属性加以区分,但是还是不可以,高手指点下,谢谢 展开
1个回答
展开全部
是不是id没有写成radio2?
function laoshi(){
var laosh = document.getElementById("radio1");
var xueshen = document.getElementById("radio2");
var yonghuming1 = document.getElementById("yonghuming");
var mima = document.getElementById("mima");
if((laosh.checked)&&(yonghuming1.value=="laoshi")&&(mima.value==123)&&(laosh.value=="老师")){
window.open("teacher/登陆成功.html");
}
else if((xuesheng.checked)&&(yonghuming1.value=="xuesheng")&&(mima.value==321)&&(laosh.value=="学生")){
window.open("student/学生登陆成功.html");
}else
window.open("登陆失败.html");
}
function laoshi(){
var laosh = document.getElementById("radio1");
var xueshen = document.getElementById("radio2");
var yonghuming1 = document.getElementById("yonghuming");
var mima = document.getElementById("mima");
if((laosh.checked)&&(yonghuming1.value=="laoshi")&&(mima.value==123)&&(laosh.value=="老师")){
window.open("teacher/登陆成功.html");
}
else if((xuesheng.checked)&&(yonghuming1.value=="xuesheng")&&(mima.value==321)&&(laosh.value=="学生")){
window.open("student/学生登陆成功.html");
}else
window.open("登陆失败.html");
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询