zoukankan      html  css  js  c++  java
  • 前端 js 实现简单 表单提交

    1. 登录页 验证用户身份,登录成功之后等待一定秒数,跳转到操作页面

    <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> 

    2. 登录成功页面中,等待5秒

    <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> 

    3. 写一个manage.html 即可

  • 相关阅读:
    原生JS之温故而知新(一)
    jQuery版本问题
    AngularJs我的学习整理(不定时修改)
    Js事件处理程序跨浏览器
    AngularJs的关于路由问题
    很棒的十句话,分享给大家。
    一个人为什么要努力?
    春熙路。
    成都
    springboot 使用mybatis-generator自动生成代码
  • 原文地址:https://www.cnblogs.com/vali/p/6096883.html
Copyright © 2011-2022 走看看