javascript写的一个注册页面,为什么验证码更新的方法会失效,急啊 游览器缓存的问题, 在你的 ajax 请求的url 后面 加一个 毫秒数 即可..应该是这个原因吧! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可是 可是 当我简化后 运行这个为什么就可以....<%@ page language="java" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <html:base /> <title>head.jsp</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="styles.css"><!--刷新的代码--><script language='JavaScript'> function checkSubmit(){ if(document.form1.signup_uid.value==""){ alert("用户名不能为空!"); document.form1.signup_uid.focus(); return false; } if(document.form1.signup_pwd.value==""){ alert("密码不能为空!"); document.form1.signup_pwd.focus(); return false; } if(document.form1.signup_pwd.value!=null && document.form1.signup_pwd.value.length<4){ alert("密码长度要大于4!"); document.form1.signup_pwd.focus(); return false; } if(document.form1.signup_pwd2.value==""){ alert("确认密码不能为空!"); document.form1.signup_pwd2.focus(); return false; } if(document.form1.signup_pwd.value != document.form1.signup_pwd2.value){ alert("两次密码不一致!!"); document.form1.signup_pwd2.focus(); return false; } if(document.form1.signup_mobilephone.value==""){ alert("手机号码不能为空!"); document.form1.signup_mobilephone.focus(); return false; } if(document.form1.signup_email.value==""){ alert("电子邮件不能为空!"); document.form1.signup_email.focus(); return false; } if(document.form1.yzm.value==""){ alert("验证码不能为空!"); document.form1.yzm.focus(); return false; } var flag = true; if(true==flag){ document.form1.submit(); flag = false; }else{ alert("你已经提交过了表单,请不要重复提交!"); } else{ return true; } } function check(){ if(document.form1.username.value==""){ alert("用户名不能为空!"); document.form1.username.focus(); return false; } if(document.form1.password.value==""){ alert("密码不能为空!"); document.form1.password.focus(); return false; } else{ return true; } } function reloadImage(url) { document.img1.src = url+'?id='+Math.random(); } </script> </head><body><form action="display.do" method="post" enctype="multipart/form-data" name="form1" id="form1"><table> <tr> <td>姓名:</td> <td><input type=text name="username"></td> </tr> <tr> <td >验证码:</td> <td nowrap="nowrap"><html:text property="rand"/> <img border=0 src="image.jsp" name="img1"> *请输入左手边图片中的数字! <a href="JavaScript:reloadImage('image.jsp');">看不清,换一张?</a> </td> </tr> <tr> <td>密码:</td> <td><input type=text name="password"></td> </tr> <tr><td><input type="submit" name="signup_submit" onClick="return check()"></td></tr></table></form> </body></html> 对不起 , 发错了 是这个 为什么这个可以...<%@ page language="java" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <html:base /> <title>head.jsp</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="styles.css"><!--刷新的代码--><script language='JavaScript'> function check(){ if(document.form1.username.value==""){ alert("用户名不能为空!"); document.form1.username.focus(); return false; } if(document.form1.password.value==""){ alert("密码不能为空!"); document.form1.password.focus(); return false; } else{ return true; } } function reloadImage(url) { document.img1.src = url+'?id='+Math.random(); } </script> </head><body><form action="display.do" method="post" enctype="multipart/form-data" name="form1" id="form1"><table> <tr> <td>姓名:</td> <td><input type=text name="username"></td> </tr> <tr> <td >验证码:</td> <td nowrap="nowrap"><html:text property="rand"/> <img border=0 src="image.jsp" name="img1"> *请输入左手边图片中的数字! <a href="JavaScript:reloadImage('image.jsp');">看不清,换一张?</a> </td> </tr> <tr> <td>密码:</td> <td><input type=text name="password"></td> </tr> <tr><td><input type="submit" name="signup_submit" onClick="return check()"></td></tr></table></form> </body></html> 肯定是check函数出问题了.LZ不用贴代码了,自己把check函数一句一句测试过去,问题肯定可以解决了 JSF 表達式問題 菜鸟求教:JSP页面跳转问题 关于html框架页数据显示的问题 请问数据类型问题。 hinernate对象关系映射的咨询 window.open如何让窗口在最上面 如何在JSP中调用一个不属于任何包的Class文件(Bean)? 数据库的连接和关闭的问题 如何将字符转为数字? 搜索了很久,还是没找到好答案:如何在jbuiler7下调试jsp JSF可以做这个么? servlet返回静态网页的问题
<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<html:base />
<title>head.jsp</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="styles.css">
<!--刷新的代码-->
<script language='JavaScript'>
function checkSubmit(){
if(document.form1.signup_uid.value==""){
alert("用户名不能为空!");
document.form1.signup_uid.focus();
return false;
}
if(document.form1.signup_pwd.value==""){
alert("密码不能为空!");
document.form1.signup_pwd.focus();
return false;
}
if(document.form1.signup_pwd.value!=null && document.form1.signup_pwd.value.length<4){
alert("密码长度要大于4!");
document.form1.signup_pwd.focus();
return false;
}
if(document.form1.signup_pwd2.value==""){
alert("确认密码不能为空!");
document.form1.signup_pwd2.focus();
return false;
}
if(document.form1.signup_pwd.value != document.form1.signup_pwd2.value){
alert("两次密码不一致!!");
document.form1.signup_pwd2.focus();
return false;
}
if(document.form1.signup_mobilephone.value==""){
alert("手机号码不能为空!");
document.form1.signup_mobilephone.focus();
return false;
}
if(document.form1.signup_email.value==""){
alert("电子邮件不能为空!");
document.form1.signup_email.focus();
return false;
}
if(document.form1.yzm.value==""){
alert("验证码不能为空!");
document.form1.yzm.focus();
return false;
}
var flag = true;
if(true==flag){
document.form1.submit();
flag = false;
}else{
alert("你已经提交过了表单,请不要重复提交!");
}
else{
return true;
}
}
function check(){
if(document.form1.username.value==""){
alert("用户名不能为空!");
document.form1.username.focus();
return false;
}
if(document.form1.password.value==""){
alert("密码不能为空!");
document.form1.password.focus();
return false;
}
else{
return true;
}
}
function reloadImage(url)
{
document.img1.src = url+'?id='+Math.random();
}
</script> </head>
<body>
<form action="display.do" method="post" enctype="multipart/form-data"
name="form1" id="form1">
<table>
<tr>
<td>姓名:</td>
<td><input type=text name="username"></td>
</tr>
<tr>
<td >验证码:</td>
<td nowrap="nowrap"><html:text property="rand"/>
<img border=0 src="image.jsp" name="img1"> *请输入左手边图片中的数字!
<a href="JavaScript:reloadImage('image.jsp');">看不清,换一张?</a>
</td>
</tr>
<tr>
<td>密码:</td>
<td><input type=text name="password"></td>
</tr>
<tr><td><input type="submit" name="signup_submit"
onClick="return check()"></td></tr>
</table>
</form>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<html:base />
<title>head.jsp</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="styles.css">
<!--刷新的代码-->
<script language='JavaScript'> function check(){
if(document.form1.username.value==""){
alert("用户名不能为空!");
document.form1.username.focus();
return false;
}
if(document.form1.password.value==""){
alert("密码不能为空!");
document.form1.password.focus();
return false;
}
else{
return true;
}
}
function reloadImage(url)
{
document.img1.src = url+'?id='+Math.random();
}
</script> </head>
<body>
<form action="display.do" method="post" enctype="multipart/form-data"
name="form1" id="form1">
<table>
<tr>
<td>姓名:</td>
<td><input type=text name="username"></td>
</tr>
<tr>
<td >验证码:</td>
<td nowrap="nowrap"><html:text property="rand"/>
<img border=0 src="image.jsp" name="img1"> *请输入左手边图片中的数字!
<a href="JavaScript:reloadImage('image.jsp');">看不清,换一张?</a>
</td>
</tr>
<tr>
<td>密码:</td>
<td><input type=text name="password"></td>
</tr>
<tr><td><input type="submit" name="signup_submit"
onClick="return check()"></td></tr>
</table>
</form>
</body>
</html>
LZ不用贴代码了,自己把check函数一句一句测试过去,问题肯定可以解决了