Home > Web Front-end > JS Tutorial > js example code to implement simple login function_javascript skills

js example code to implement simple login function_javascript skills

WBOY
Release: 2016-05-16 17:16:30
Original
1566 people have browsed it

复制代码 代码如下:



 
    Login.html

   
   
   

   
   
 

 
   

      u:

      p:

     
   

 


这是登录页面,只有当用户名为lala,密码为123时登录成功。在onclick事件处使用return,是在用户名和密码输入不符时,阻止页面跳转。登录成功页面中,含有等待秒数,代码为:

复制代码 代码如下:



 
    ok.html

   
   
   

   
   
 

 
    登录成功,5秒后自动跳转到管理页面
 


关键在几个函数的使用,setTimeout("tiao()",5000);函数是打开页面,等待5秒,调用tiao()函数。setInterval("changeSec()",1000);函数是每隔1秒调用一次changeSec()函数。这样就完成了简单的登录功能。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template