简单程序的小问题。接分了。
初学jsp在试着写了个登陆界面但调用不了javascript里的函数请大家帮忙看看哈。
<%@ page contentType= "text/html; charset=gbk " language= "java " import= "java.sql.* "
errorPage= " " %>
<script language= "javascript ">
function on_submit()
{
if(form1.username.value= " ")
{
alert( "用户名不为空,请输入用户名 ");
form1.username.focus();
return false;
}
if(form1.code.value= " ")
{
alert( "密码不能为空 ");
form1.code.focus();
return false;
}
if(form1.reputcode.value!=form1.code.value)
{
alert(两次输入密码不一致);
form1.code.reputcode.focus();
return false;
}
if(form1.email.value.length!=0)
{
for(i=0;i <form1.email.value.length;i++)
{
if(form1.email.value.charAt(i)==@)
break;
}
if(i==form1.email.value.length)
{
alert( "错误email地址 ");
form1.email.focus();
return false;
}
}
}
</script>
<html>
<head>
<title> Untitled Document </title>
</head>
<body>
<center> 新用户注册 </center>
<form name= "form1 " method= "POST " action= "acceptUserregist.jsp " onsubmit= "return on_submit() ">
用户名(*): <input type= "text " name= "username " /> <br>
密码(*): <input type= "text " name= "code " /> <br>
请再输入一次密码(*): <input type= "text " name= "reputcode " /> <br>
性别 <input type= "radio " value= "男 " checked= "checked " name= "sex " /> 男 <input type= "radio " value= "女 " name= "sex " /> 女 <br>
出生年月 <input type= "text " name= "year " size= "4 " /> 年
<select name= "month ">
<option value= "1 " selected= "selected "> 1 </option>
<option value= "2 "> 2 </option>
<option value= "3 "> 3 </option>
<option value= "4 "> 4 </option>
<option value= "5 "> 5 </option>
<option value= "6 "> 6 </option>
<option value= "7 "> 7 </option>
<option value= "8 "> 8 </option>
<option value= "8 "> 9 </option>
<option value= "8 "> 10 </option>
<option value= "8 "> 11 </option>
<option value= "8 "> 12 </option>
</select>
月
<input type= "text " name= "day