javascript实现的登陆遮罩效果汇总(3)

<!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> <title></title> <script type="text/javascript"> function showLogin() { var loginDiv = document.getElementById("loginDiv"); var zhezhao = document.getElementById("zhezhao"); var clientx = document.documentElement.clientWidth; var clienty = document.documentElement.clientHeight; var l_margin = (clientx - parseInt(loginDiv.style.width)) / 2; var t_margin = (clienty - parseInt(loginDiv.style.height)-200) / 2 loginDiv.style.left = l_margin + "px"; loginDiv.style.top = t_margin +"px"; loginDiv.style.display = "block"; zhezhao.style.display = "block"; } function hidLogin() { var loginDiv = document.getElementById("loginDiv"); var zhezhao = document.getElementById("zhezhao"); loginDiv.style.display = "none"; zhezhao.style.display = "none"; } function titleMove() { var moveable = true; var loginDiv = document.getElementById("loginDiv"); //以下变量提前设置好 var clientX = window.event.clientX; var clientY = window.event.clientY; var moveTop = parseInt(loginDiv.style.top); var moveLeft = parseInt(loginDiv.style.left); document.onmousemove = function MouseMove() { if (moveable) { var y = moveTop + window.event.clientY - clientY; var x = moveLeft + window.event.clientX - clientX; if (x > 0 && y > 0) { loginDiv.style.top = y + "px"; loginDiv.style.left = x + "px"; } } } document.onmouseup = function Mouseup() { moveable = false; } } </script> </head> <body> <!--Main start z-index:0--> <div> <a href="javascript:showLogin()">登陆</a> </div> <!--Main start z-index:0--> <!--loginDiv start :z-index:2--> <div> <div onmousedown="titleMove()"> <!--<img src="https://www.zhujiangroad.com/images/close.jpg"/>--> <a href="javascript:hidLogin()">×</a> </div> <table> <tr><td>用户名:</td><td><input type="text" /></td><td> </td></tr> <tr><td>密码:</td><td><input type="text" /></td><td> </td></tr> <tr><td><br /></td><td></td></tr> </table> </div> <!--loginDiv end :z-index:2--> <!--zhezhao start: z-index:1--> <div> <!--zhezhao end--> </div> </body> </html>

例子三:

<head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>弹出登录框的实现代码</title> </head> <body> <style type="text/css"> body { margin: 0px;padding:0 } #div1 { display: none; position: absolute; z-index: 1000; height: 100%; width: 100%; background: #000000; filter:Alpha(opacity=30); } #div2 { display: none; position: absolute; height: 100%; width: 100%; padding-top: 10%; z-index: 1001; left: 0px; top: 0px; } </style> <script> function openme(){ document.getElementById('div1').style.display='block'; document.getElementById('div2').style.display='block'; } function closeme(){ document.getElementById('div1').style.display='none'; document.getElementById('div2').style.display='none'; } function logo_in(){alert() //验证 //转向... //myform.action="" //myform.submit() closeme(); } </script> <div></div> <div> <table cellpadding="3" cellspacing="1"> <tr> <td><font color="#FFFFFF">欢迎登陆:</font></td> <td> <input type="button" value="x"> </td> </tr> <tr> <form method="post" > <td colspan="2" bgcolor="#FFFFFF"> username: <input type="text" size="10"> <br>pasword:<input type="password" size="12"> <br><input type="button" value="登陆"> <input type="button" value="取消"> </td> </form> </tr> </table> </div> <div> <input type="button" value="登陆" /> </div> <br> <div> 简单的代码 </div> </body> </html>

例子四

js制作带有遮罩弹出层实现登录注册表单代码特效

<!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>js制作带有遮罩弹出层实现登录注册表单代码特效</title> <link type="text/css" href="https://www.jb51.net/css/198zone.css"> </head> <body> <a data-toggle="modal" href="#login-modal">登录</a> <a data-toggle="modal" href="#signup-modal">注册</a> <a data-toggle="modal" href="#forgetform">找回密码</a> <a data-toggle="modal" href="#activation-modal">用户信息</a> <a data-toggle="modal" href="#setpassword-modal">重置密码</a> <div> <a data-dismiss="modal">×</a> <h1>登录</h1> <ul> <li> <a href="https://www.jb51.net"><em>&nbsp;</em> QQ登录</a> </li> <li> <a href="https://www.jb51.net"><em>&nbsp;</em> 微博登录</a> </li> <li> <a href="https://www.jb51.net"><em>&nbsp;</em> 豆瓣登录</a> </li> </ul> <p>或者使用已有帐号登陆:</p> <form method="post" action="https://www.jb51.net"> <div></div> <input type="text" placeholder="邮箱:"> <input type="password" placeholder="密码:"> <input type="submit" value="登录"> <input type="hidden" value=""> <div></div> <label><input type="checkbox" checked />下次自动登录 </label> <a>忘记密码?</a> <ul> <li><p>新浪微博帐号</p></li> <li><p>腾讯微博帐号</p></li> <li><p>豆瓣帐号</p></li> <li><p></p></li> </ul> </form> </div> <div> <a data-dismiss="modal">×</a> <h1>注册</h1> <ul> <li> <a href="https://www.jb51.net"><em>&nbsp;</em> QQ登录</a> </li> <li> <a href="https://www.jb51.net"><em>&nbsp;</em> 微博登录</a> </li> <li> <a href="https://www.jb51.net"><em>&nbsp;</em> 豆瓣登录</a> </li> </ul> <p>或者使用邮箱注册:</p> <form method="post" action="https://www.jb51.net"> <p></p> <input type="text" placeholder="邮箱:"> <input type="password" placeholder="密码:"> <input type="password" placeholder="确认密码:"> <input type="text" placeholder="用户名:"> <input type="hidden" value=""> <input type="hidden" value=""> <div></div> <input type="button" value="注册" data-action="regist"> <ul> <li><p>新浪微博帐号</p></li> <li><p>腾讯微博帐号</p></li> <li><p>豆瓣帐号</p></li> </ul> </form> </div> <div> <a data-dismiss="modal">×</a> <h1>忘记密码</h1> <form method="post" action="https://www.jb51.net"> <input value="" placeholder="注册邮箱:"> <div></div> <input type="submit" value="发送重设密码邮件"> </form> </div> <div> <a data-dismiss="modal">×</a> <h1>设置用户信息</h1> <form method="post" action="https://www.jb51.net"> <input autocomplete=off value="" placeholder="用户名:"> <input autocomplete=off type="password" placeholder="密码:"> <input autocomplete=off type="password" placeholder="确认密码:"> <input type="submit" value="确认并登录" data-action="regist"> <div></div> </form> </div> <div> <a data-dismiss="modal">×</a> <h1>重置密码</h1> <form method="post" action="https://www.jb51.net"> <input value=""> <input type="password" placeholder="密码:"> <input type="password" placeholder="确认密码:"> <input type="hidden" value=""> <input type="submit" value="设置新密码并登录" data-action="reset"> <div></div> </form> </div> <script type="text/javascript" src="https://www.jb51.net/js/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="https://www.jb51.net/js/modal.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("a.forgot").click(function(){ $("#login-modal").modal("hide"); $("#forgetform").modal({show:!0}) }); $("#signup-modal").modal("hide"); $("#forgetform").modal("hide"); $("#login-modal").modal("hide"); $("#activation-modal").modal("hide"); $("#setpassword-modal").modal("hide"); }); </script> <div><script src="https://demo.jb51.net/js/tj.js"></script></div> <script src="https://demo.jb51.net/js/yxj.js" type="text/javascript"></script> </body> </html>

演示:

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgzxdx.html