dwr实现找回密码的功能
2009-09-17 00:00:00 来源:WEB开发网getPassword.jsp中调用
Java代码
<script type='text/javascript' src='<%=path%>/dwr/interface/UsersService.js'></script>
<script type='text/javascript' src='<%=path%>/dwr/interface/SendMail.js'></script>
<script type='text/javascript' src='<%=path%>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=path%>/dwr/util.js'></script>
<script type="text/javascript">
function Trim(str){
return str.replace(/^\s*|\s*$/g,"");
}
function getPassword(){
var account = document.getElementById("account").value;
var email = document.getElementById("email").value;
//var passCode = document.getElementById("getPassword_passCode").value;
if(Trim(account)==""||Trim(email)==""){
alert("所填信息均不能为空!");
return ;
}
if (email !=""&&email.search(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/ ) == -1){
alert("邮箱格式不对!");
return ;
}
UsersService.getPassword(account,email,function(result){
if(result==""){
window.alert("账号或邮箱错误!");
}else {
var title = "找回密码";
var text = "你的账号密码为:"+result+",请妥善保管密码!";
var path = "";//附件路径
SendMail.send(email, title, text, path,function(date){
if(date==1){
window.alert("密码已经发送到你的邮箱!");
window.close();
}else{
window.alert("密码发送到失败,请稍后再试!");
}
});
}
});
}
</script>
更多精彩
赞助商链接