這篇文章主要介紹了關於js實作簡單登入功能的實例程式碼,有著一定的參考價值,現在分享給大家,有需要的朋友可以參考一下
##複製程式碼 程式碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Login.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <script type="text/javascript"> function checkuser() { if($('uname' == "lala") && $('pwd') == "123") { return true; }else { return false; } } function $(id) { return document.getElementById(id).value; } </script> </head> <body> <form action="ok.html"> u:<input type="text" id="uname"/><br> p:<input type="password" id="pwd"/><br> <input type="submit" value="登录" onclick="return checkuser()"/> </form> </body> </html>
複製程式碼 程式碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>ok.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <script type="text/javascript"> function tiao() { clearInterval(mytime); window.open("manage.html","_self"); } setTimeout("tiao()",5000); function changeSec() { //得到myspan值 $('myspan').innerText=$('myspan').innerText-1; } function $(id) { return document.getElementById(id); } var mytime = setInterval("changeSec()",1000); </script> </head> <body> 登录成功,<span id="myspan">5</span>秒后自动跳转到管理页面 </body> </html>
#
以上是js實作簡單登入功能的實例程式碼的詳細內容。更多資訊請關注PHP中文網其他相關文章!