登录表单中验证用户登录

简介:

ono

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html  xmlns = "http://www.w3.org/1999/xhtml"  >
< head >
     < meta  http-equiv = "Content-Type"  content = "text/html; charset=utf-8" >
     < title >测试页</ title >
     < script  type = "text/javascript" >
         function check(){
             if(form1.user.value.trim()==""){
                 alert("请输入用户名!");
                 form1.user.focus();
                 return;
             }
             else if(form1.pwd.value.trim()==""){
                 alert("请输入密码!");
                 form1.pwd.focus();
                 return;
             }
             else{
                 form1.submit();
             }
         }
     </ script >
</ head >
< body >
     < form  name = "form1"  method = "post"  action = "Cover.html" >
         用户名:< input  name = "user"  type = "text"  id = "user" >
         密码:< input  name = "pwd"  type = "text"  id = "pwd" >
         < input  name = "btnLogin"  type = "button"  value = "登录"     >
          < input  name = "btnRes"  type = "reset"  value = "重置" >
     </ form >
</ body >
</ html >

在HEML中调用事件处理程序,在登录按钮的onclick事件中调用check()函数,实现登录验证。






     本文转自stock0991 51CTO博客,原文链接:http://blog.51cto.com/qing0991/1341344,如需转载请自行联系原作者






相关文章
|
1月前
who 查看登录用户信息
who 查看登录用户信息。
48 5
|
4月前
|
存储 前端开发
通过session实现用户的登录与登出功能
通过session实现用户的登录与登出功能
64 0
|
9月前
|
前端开发 数据安全/隐私保护
|
JavaScript Java
实现登录时进行校验验证码的功能
JavaEE中,实现登录时进行校验验证码的功能(图文并茂!!!)
实现登录时进行校验验证码的功能
[导入]用户登录及验证用户是否登录的代码
用户登录及验证用户是否登录的代码文章来源:http://blog.csdn.net/jyk/archive/2006/08/15/1067382.aspx
676 0
|
数据安全/隐私保护
9、获取用户的详细信息接口,如果用户没有登录,我们提示用户登录
controller: //获取用户详细信息接口,当用户没有登录,我们强制让其登录 @RequestMapping(value = "get_information.
1099 0
|
内存技术 数据安全/隐私保护