<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <script type="text/javascript"> window.onload = function(){ document.getElementById("admin").focus(); } function check_admin(admininfo){ if(admininfo==null || admininfo.length == 0 || !new RegExp(/^[a-zA-Z]{3,20}$/).test(admininfo)){ return false ; }else{ return true ; } } function check_pwd(pwdinfo){ if(pwdinfo==null || pwdinfo.length == 0 || !new RegExp(/^\d{6}$/).test(pwdinfo)){ return false ; }else{ return true ; } } function check_yzm(yzminfo){ if(yzminfo==null || yzminfo.length == 0 || !new RegExp(/^[A-Za-z0-9]{5}$/).test(yzminfo)){ return false ; }else{ return true ; } } function onblur_show_admin_success_msg(){ var admin = document.getElementById("admin").value ; var flag = check_admin(admin); if(flag){ document.getElementById("admin_msg").innerHTML = "<b style='color:green;'>格式正确!</b>" ; }else{ document.getElementById("admin_msg").innerHTML = "管理员账号有误,请重新填写!" ; } } function onblur_show_pwd_success_msg(){ var pwd = document.getElementById("pwd").value ; var flag = check_pwd(pwd) ; if(flag){ document.getElementById("pwd_msg").innerHTML = "<b style='color:green;'>格式正确!</b>" ; }else{ document.getElementById("pwd_msg").innerHTML = "管理员密码有误,请重新填写!" ; } } function onblur_show_yzm_success_msg(){ var yzm = document.getElementById("yzm").value ; var flag = check_yzm(yzm) ; if(flag){ document.getElementById("yzm_msg").innerHTML = "<b style='color:green;'>格式正确!</b>" ; }else{ document.getElementById("yzm_msg").innerHTML = "验证码有误,请重新填写!" ; } } function clear_admin_msg(){ document.getElementById("admin_msg").innerHTML = "" ; } function clear_pwd_msg(){ document.getElementById("pwd_msg").innerHTML = "" ; } function clear_yzm_msg(){ document.getElementById("yzm_msg").innerHTML = "" ; } function onsubmit_check_all_data(){ var admin = document.getElementById("admin").value ; var pwd = document.getElementById("pwd").value ; var yzm = document.getElementById("yzm").value ; if(!check_admin(admin)||!check_pwd(pwd)||!check_yzm(yzm)){ return false ; } /* var flag_admin = check_admin(admin) ; var flag_pwd = check_pwd(pwd); var flag_yzm = check_yzm(yzm); if(flag_admin&&flag_pwd&&flag_yzm){ return true ; }else{ return false ; } if(!flag_admin||!flag_pwd||!flag_yzm){ return false ; } */ } </script> <div class="body"> <div class="login"> <form action="login.action" method="post" class="loginform" onsubmit="return onsubmit_check_all_data();"> <fieldset> <legend>系统管理员登陆窗口</legend> <div class="margin_padding"></div> <p> <label for="admin">管理员账号</label><br/> <span class="margin_padding"></span> <input type="text" name="admin" id="admin" style="width:200px;height:25px;" onfocus="clear_admin_msg();" onblur="onblur_show_admin_success_msg();"> <span id="admin_msg" style="color: red;font-style: italic;"></span> </p> <span class="margin_padding"></span> <p> <label for="pwd">管理员密码</label><br/> <span class="margin_padding"></span> <input type="password" name="pwd" id="pwd" style="width:200px;height:25px;" onfocus="clear_pwd_msg();" onblur="onblur_show_pwd_success_msg();"> <span id="pwd_msg" style="color: red;font-style: italic;"></span> </p> <span class="margin_padding"></span> <p> <label for="yzm">输入验证码</label><span style="color:#555;font-size:10px;">(看不清楚,请点击图片刷新!)</span><br> <span class="margin_padding"></span> <input type="text" name="yzm" id="yzm" style="width:100px;height:25px;" onfocus="clear_yzm_msg();" onblur="onblur_show_yzm_success_msg();"> <img alt="loading..." src="yzm.action" style="width:100px;height:25px;" id="yzmpic" onclick="refrushyzm();" onmouseover="showpointer();"> <span id="yzm_msg" style="color: red;font-style: italic;"></span> </p> <span class="margin_padding"></span> <p> <input type="submit" value="管理员登录" id="submit"> </p> <span class="margin_padding"></span> </fieldset> </form> </div> </div>
时间: 2024-10-14 04:15:09