JavaScript實(shí)現(xiàn)點(diǎn)擊文字切換登錄窗口的方法
本文實(shí)例講述了JavaScript實(shí)現(xiàn)點(diǎn)擊文字切換登錄窗口的方法。分享給大家供大家參考。具體分析如下:
這是一款動(dòng)畫切換層窗口的特效,點(diǎn)擊不同的登錄用戶會(huì)切換到不同的登錄窗口,窗口內(nèi)的內(nèi)容可以是不一樣的,是比較實(shí)用的一款代碼。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JAVASCRIPT適時(shí)切換登錄窗口</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 id="menu_0" style="position: absolute; top: 127; left: 176; width: 340; height: 201">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="19">
<tr>
<td width="277" class="out" height="19" style="cursor: default"> </td>
<td width="58" class="out" height="19" onmousedown="Show_menu(1,0)" onmouseup="returnIT()">管理員</td>
</tr>
</table>
<div id="div_0" style="position: relative; width: 339; height: 1; overflow: hidden">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="182">
<tr>
<td width="100%" height="182">
<form id="form_0" style="position: relative; left:70; top:10;font-family: Arial; display: none"
action="javascript:;" method="post" align="center">
超級(jí)管理員:
<br>
<br>
帳號(hào): <input class="in" style="WIDTH: 100px" size="20"> mail.cn<br>
密碼: <input class="in" type="password" size="20"><br>
<br>
<input class="out" onfocus="this.blur()" type="button" value="登錄">
</form>
</td>
</tr>
</table>
</div>
</div>
<div id="menu_1" style="position: absolute; top: 146; left: 176; width: 339; height: 219">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="19">
<tr>
<td width="277" class="out" height="19" style="cursor: default"> </td>
<td width="58" class="out" height="19" onmousedown="Show_menu(0,1)" onmouseup="returnIT()">一般用戶</td>
</tr>
</table>
<div id="div_1" style="position: relative; width: 339; height: 182; overflow: hidden">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td width="100%" height="182">
<form id="form_1" style="position: relative; left:70; top:10;font-family: Arial; display: block" action="javascript:;"
method="post" align="center">
一般用戶:
<br>
<br>
帳號(hào): <input class="in" style="WIDTH: 100px" size="20"> mail.cn<br>
口令: <input class="in" type="password" size="20"><br>
<br>
<input class="out" onfocus="this.blur()" type="button" value="登錄">
</form>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。
相關(guān)文章
uniapp實(shí)現(xiàn)h5、app與微信小程序三端pdf文件下載和預(yù)覽功能
作為使用uni-app的小白來說,嘗試了好幾種方法,終于得到了我想要的效果,下面這篇文章主要給大家介紹了關(guān)于uniapp實(shí)現(xiàn)h5、app與微信小程序三端pdf文件下載和預(yù)覽功能的相關(guān)資料,需要的朋友可以參考下2022-12-12
JavaScript開發(fā)中需要搞懂的字符編碼總結(jié)
字符集就是字符的集合,字符編碼則代表字符集的實(shí)際編碼規(guī)則,是用于計(jì)算機(jī)解析字符的。本文為大家整理了JavaScript開發(fā)中需要搞懂的字符編碼,希望對(duì)大家有所幫助2023-02-02
js 復(fù)制功能 支持 for IE/FireFox/mozilla/ns
js 復(fù)制功能 支持 for IE/FireFox/mozilla/ns...2007-11-11
微信小程序上傳帖子的實(shí)例代碼(含有文字圖片的微信驗(yàn)證)
這篇文章主要介紹了小程序上傳帖子(含有文字圖片的微信驗(yàn)證)的實(shí)例代碼,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-07-07
基于Javascript實(shí)現(xiàn)的不重復(fù)ID的生成器
本文介紹了js生成一個(gè)不重復(fù)的ID的函數(shù)的進(jìn)化之路,具有一定的參考價(jià)值,需要的朋友一起來看下吧2016-12-12

