<html>
<head>
<title>login.html</title>
<script language="javascript">
function fun(thisurl){
window.open(thisurl) ;
window.close();
window.opener.location.reload();
}
</script>
<script language="javascript">
function fc(){
var value = document.login.userName.value ;
var value1 = document.login.pwd.value ;
if(document.login.stusex[0].checked) {
login.action="login";
if(value==""){
alert("用户名为空");
document.getElementById("userName").focus();
}else if(value1==""){
alert("密码为空");
document.getElementById("pwd").focus();
}
else{
login.submit();
}
}
}
</script>
</head>
<body>
<center>
<font size="6">综合教务管理系统</font>
<form name="login" action=" " method="post" id="form1">
用户名:<input type="text" name="userName"><br/>
<br/>
密码:<input type="password" name="pwd"><br/><br/>
input type="button" value="登陆" onclick="fc()">
<input type="reset" value="重置">
<input type="button" value="注册" onclick="fun('zhuce.html')"><br/><br/>
select name="stusex">
<option value="学生">学生</option>
<option value="教务管理员" >教务管理员</option>
</select>
</form>
</center>
</body>
</html>
为什么我选学生登陆时没反应啊
<head>
<title>login.html</title>
<script language="javascript">
function fun(thisurl){
window.open(thisurl) ;
window.close();
window.opener.location.reload();
}
</script>
<script language="javascript">
function fc(){
var value = document.login.userName.value ;
var value1 = document.login.pwd.value ;
if(document.login.stusex[0].checked) {
login.action="login";
if(value==""){
alert("用户名为空");
document.getElementById("userName").focus();
}else if(value1==""){
alert("密码为空");
document.getElementById("pwd").focus();
}
else{
login.submit();
}
}
}
</script>
</head>
<body>
<center>
<font size="6">综合教务管理系统</font>
<form name="login" action=" " method="post" id="form1">
用户名:<input type="text" name="userName"><br/>
<br/>
密码:<input type="password" name="pwd"><br/><br/>
input type="button" value="登陆" onclick="fc()">
<input type="reset" value="重置">
<input type="button" value="注册" onclick="fun('zhuce.html')"><br/><br/>
select name="stusex">
<option value="学生">学生</option>
<option value="教务管理员" >教务管理员</option>
</select>
</form>
</center>
</body>
</html>
为什么我选学生登陆时没反应啊
解决方案 »
- ant执行其他xml的target问题
- 请教一个SPRING和HIBERNATE配置文件出错的问题
- 异常java.lang.IllegalStateException
- spring2.5的@Component注解为什么离开IDE就失效了呢???
- 关于struts表单验证validate的问题
- Eclipse压缩jar运行出现问题,牛人在哪儿?
- 有webservice的例子吗?demo源代码,或者是xfire也行哦...
- hibernate: Session is closed!
- Java EJB 中的session Bean怎样来执行复杂的数据库操做
- 关于hibernate
- struts 导出excel的问题,在线等!
- 为什么maven3无法搜索到远程的jar文件?
document.login返回的是一个数组
你要么改成document.login[0],
要么改成document.form1
加一行var login = document.getElementById('login');另外,如果表单中,有某个元素名称叫做name="submit"的话,改下名,不要和login.submit()中的submit重名。
改成
if(document.login.stusex[0].selected 或者
if(document.login.stusex[0].selectedIndex != -1) 都可以
var form = document.getElementById("login");