JavaScript实现点击文字切换登录窗口的方法

这是一款动画切换层窗口的特效,点击不同的登录用户会切换到不同的登录窗口,窗口内的内容可以是不一样的,是比较实用的一款代码。

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JAVASCRIPT适时切换登录窗口</title> <style> TD{ font-size: 9pt; color: #66DDDD} .out{ font-size: 9pt; color: #66DDDD;border-width:1px; border-style:solid;border-color:0090c0 0070b0 0070b0 0090c0; cursor:hand; background:0080c0; text-align: center } .out2 { text-align: center} .in,.out2{ font-size: 9pt; color: #66DDDD;border-width:1px; border-style:solid;border-color:0070b0 0090c0 0090c0 0070b0; background:0078b8;cursor:default } </style> </head> <body> <script> var temp_num = null; var now_num = null; var the_top = 130; var the_bottom = 150 var no_can_do = false; function Show_menu(u_num,d_num) { event.srcElement.className = "out2"; if(no_can_do) { return; } now_num = d_num; if(temp_num) { if(document.getElementById("menu_"+temp_num).doing) { clearInterval(document.getElementById("menu_"+temp_num).doing); } } else { temp_num = u_num; } document.getElementById("menu_"+temp_num).doing = setInterval("set_menu()",10); } function set_menu() { no_can_do = true; document.getElementById("form_"+temp_num).style.display = "none"; var if_move = document.getElementById("div_"+temp_num).style.pixelHeight - 6; if(if_move>1) { document.getElementById("div_"+temp_num).style.pixelHeight = if_move; } else { document.getElementById("div_"+temp_num).style.pixelHeight = 1; var if_stop = document.getElementById("menu_"+temp_num).style.pixelTop - 1; if(if_stop>the_top) { document.getElementById("menu_"+temp_num).style.pixelTop = if_stop; document.getElementById("menu_"+now_num).style.pixelTop += 1; } else { document.getElementById("menu_"+temp_num).style.pixelTop = the_top; document.getElementById("menu_"+now_num).style.pixelTop = the_bottom; var if_end = document.getElementById("div_"+now_num).style.pixelHeight + 6; if(if_end < 182) { document.getElementById("div_"+now_num).style.pixelHeight = if_end } else { document.getElementById("div_"+now_num).style.pixelHeight = 182; clearInterval(document.getElementById("menu_"+temp_num).doing); document.getElementById("menu_"+temp_num).doing = false; document.getElementById("form_"+now_num).style.display = "block"; temp_num = null; no_can_do = false; } } } } function returnIT() { event.srcElement.className = "out"; } </script> <div> <table cellspacing="0" cellpadding="0"> <tr> <td> </td> <td onmousedown="Show_menu(1,0)" onmouseup="returnIT()">管理员</td> </tr> </table> <div> <table cellspacing="0" cellpadding="0"> <tr> <td> <form action="javascript:;" method="post"> 超级管理员: <br> <br> 帐号: <input size="20"> mail.cn<br> 密码: <input type="password" size="20"><br> <br> <input onfocus="this.blur()" type="button" value="登录"> </form>  </td> </tr> </table> </div> </div> <div> <table cellspacing="0" cellpadding="0"> <tr> <td> </td> <td onmousedown="Show_menu(0,1)" onmouseup="returnIT()">一般用户</td> </tr> </table> <div> <table cellspacing="0" cellpadding="0"> <tr> <td> <form action="javascript:;" method="post"> 一般用户: <br> <br> 帐号: <input size="20"> mail.cn<br> 口令: <input type="password" size="20"><br> <br> <input onfocus="this.blur()" type="button" value="登录"> </form>  </td> </tr> </table> </div> </div> </body> </html>

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

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