jszm 实现点击弹窗弹出登录框

发布时间:2021-04-20 11:45:06 作者:小新
来源:亿速云 阅读:666

这篇文章将为大家详细讲解有关jszm 实现点击弹窗弹出登录框,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

js的作用是什么

1、能够嵌入动态文本于HTML页面。2、对浏览器事件做出响应。3、读写HTML元素。4、在数据被提交到服务器之前验证数据。5、检测访客的浏览器信息。6、控制cookies,包括创建和修改等。7、基于Node.js技术进行服务器端编程。

本文实例为大家分享了js实现点击弹窗弹出登录框的具体代码,供大家参考,具体内容如下

1 图片预览

jszm 实现点击弹窗弹出登录框

2 index.html代码

<!DOCTYPE html>
<html lang="zh">
 <head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>js点击弹窗弹出登录框代码</title>
 </head>
 <body>
  <style>
   *{ 
    margin:0;
    padding:0;
   }
         button, input{
    outline:none;
   }
   button, .login{
    width:120px; 
    height:42px; 
    background:#f40; 
    color:#fff; 
    border:none; 
    border-radius:6px;
    display: block;
    margin:20px auto; 
    cursor: pointer;
   }
   .popOutBg{
    width:100%;
    height:100%;
    position: fixed;
    left:0;
    top:0;
    background:rgba(0,0,0,.6);
    display: none;
   }
   .popOut{
    position:fixed;
    width:600px; 
    height:300px;
    top:50%;
    left:50%;
    margin-top:-150px;
    margin-left:-300px;
    background:#fff;
    border-radius:8px;
    overflow: hidden;
    display: none;
   }
   .popOut > span{
    position: absolute;
    right:10px;
    top:0; 
    height:42px;
    line-height:42px;
    color:#000;
    font-size:30px;
    cursor: pointer;
   }
   .popOut table{
    display: block;
    margin:42px auto 0;
    width:520px;
   }
   .popOut caption{
    width:520px;
    text-align: center;
    color:#f40;
    font-size:18px;
    line-height:42px;
   }
   .popOut table tr td{
    color:#666;
    padding:6px;
    font-size:14px;
   }
   .popOut table tr td:first-child{
    text-align: right;
   }
   .inp{
    width:280px;
    height:30px;
    line-height:30px;
    border:1px solid #999;
    padding:5px 10px;
    color:#000;
    font-size:14px;
    border-radius:6px;
   }
   .inp:focus{ 
    border-color:#f40;
   }
   @keyframes ani{
    from{
     transform:translateX(-100%) rotate(-60deg) scale(.5);
    }
    50%{
     transform:translateX(0) rotate(0) scale(1);
    }
    90%{
     transform:translateX(20px) rotate(0) scale(.8);
    }
    to{
     transform:translateX(0) rotate(0) scale(1);
    }
   }
   .ani{ animation:ani .5s ease-in-out;}
  </style>
  <button type="button">登录</button>
  <div class="popOutBg"></div>
  <div class="popOut">
   <span title="关闭"> x </span>
   <table>
    <caption>欢迎登录本网站</caption>
    <tr>
     <td width="120">用户名:</td>
     <td><input type="text" class="inp" placeholder="请输入用户名" /></td>
    </tr>
    <tr>
     <td>密码:</td>
     <td><input type="password" class="inp" placeholder="请输入密码" /></td>
    </tr>
    <tr>
     <td colspan="2"><input type="button" class="login" value="登录" /></td>
    </tr>
   </table>
  </div>
  <script type="text/javascript">
   function $(param) {
    if (arguments[1] == true) {
     return document.querySelectorAll(param);
    } else {
     return document.querySelector(param);
    }
   }
   function ani() {
    $(".popOut").className = "popOut ani";
   }
   $("button").onclick = function() {
    $(".popOut").style.display = "block";
    ani();
    $(".popOutBg").style.display = "block";
   };
   $(".popOut > span").onclick = function() {
    $(".popOut").style.display = "none";
    $(".popOutBg").style.display = "none";
   };
   $(".popOutBg").onclick = function() {
    $(".popOut").style.display = "none";
    $(".popOutBg").style.display = "none";
   };
  </script>
 </body>
</html>

关于“jszm 实现点击弹窗弹出登录框”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

推荐阅读:
  1. 用JS实现根据当前时间随机生成流水号或者订单号
  2. Javascript获取某个月的天数

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

js

上一篇:js如何实现移动端H5页面手指滑动刻度尺功能

下一篇:nodejsruh 实现连接mongodb数据库

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》