用戶登錄  |  用戶注冊
首 頁源碼下載網絡學院最新源碼源碼排行屏蔽廣告
當前位置:新興網絡 > 網絡學院 > 網頁制作 > JavaScript

JavaScript 彈出登陸窗口背景半透明可拖動效果

減小字體 增大字體 作者:LinHaibo  來源:新興網絡  發布時間:2010-05-09 17:44:58
HTML code運行代碼復制代碼編輯
<html>
 <head>
  <meta http-equiv="Content-Type"content="text/html; charset=gb2312"/>
    <meta name="author" content="www.suasdey.com" />
    <meta name="author email" content="123@linhaibo.com" />
 <title>彈出窗口登錄效果</title>
<style>
body,p {
    margin: 0;
    padding: 0;
    text-align: center;
    font: normal 14px/180% Tahoma,sans-serif;
}
#loginBox {
    margin: 0 auto;
    padding: 0px;
    text-align: left;
    width: 280px;
    height: 150px;
    background: #EAEEFF;
    font-size: 9pt;
    border: 1px solid #829AFF;
    overflow: hidden;
    filter: alpha(opacity=90);
    opacity: 0.9;
}
#loginBox .title {
    text-align: left;
    padding-left: 10px;
    font-size: 11pt;
    border-bottom: 1px solid #829AFF;
    height: 25px;
    line-height: 25px;
    cursor: move;
}
#loginBox .t1 {
    float: left;
    font-weight: bold;
    color: #AA7B7B;
    text-decoration: none;
}
#loginBox .t2 {
    float: right;
    text-align: center;
    line-height: 18px;
    height: 18px;
    width: 18px;
    margin-top: 3px;
    margin-right: 2px;
    overflow: hidden;
    border: 1px solid #FF5889;
    background: #FFE0E9;
    cursor: pointer;
}
#loginBox .login {
    text-align: center;
    width: 100%;
    height: 100%;
}
input.submit {
    float: right;
    border: 1px solid #829AFF;
    FONT-SIZE: 9pt;
    background: #EAEEFF;
    HEIGHT: 20px;
    margin-top: 5px;
    margin-right: 70px;
}
#bgDiv {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0px;
    left: 0px;
    right: 0px;
    background-color: #777;
    filter: progid: DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75) filter: alpha(opacity=70);
    opacity: 0.7;
}
</style>
 </head>
 <body>
 <div id="bgDiv" style="display:none;">
 </div>
   <a href="javascript:" onClick="bgDiv.style.display='';login.style.display='';">登錄</a>
    <br><br><a href="http://www.suasdey.com">新興網絡</a>
 <div style="position:absolute; left:378px; top:150px; z-index:1; display: none;" id="login">
  <div id="loginBox">
    <p class="title" id="Mdown"><span class="t1">登錄</span><span class="t2" title="關閉" onClick="login.style.display='none';bgDiv.style.display='none'">X</span></p>
       <div class="login"><form method="post" action="post.asp">用戶名:<input type="text"name="UserName" size="12" maxlength="10"><div class="login">密 碼:<input type="text"name="Password" size="12" maxlength="10"></div><input class="submit" type="submit" value="登錄"></form></div>
    </div>
 </div>
<script type="text/javascript">
      var IsMousedown, LEFT, TOP, S;
      document.getElementById("Mdown").onmousedown=function(e) {
        S = document.getElementById("login");
        IsMousedown = true;
        e = e||event;
        LEFT = e.clientX - parseInt(S.style.left);
        TOP = e.clientY - parseInt(S.style.top);
        document.body.onmousemove = function(e) {
            e = e||event;
            if (IsMousedown) {
                S.style.left = e.clientX - LEFT + "px";
                S.style.top = e.clientY - TOP + "px";
            }
        }
        document.onmouseup=function(){IsMousedown=false;}
   }
</SCRIPT>
</body>
</html>

Tags:JavaScript 彈出窗口 登陸 半透明 層拖動

作者:LinHaibo
  • 好的評價 如果您覺得此文章好,就請您
      92%(12)
  • 差的評價 如果您覺得此文章差,就請您
      8%(1)

網絡學院評論評論內容只代表網友觀點,與本站立場無關!

   評論摘要(共 2 條,得分 185 分,平均 92 分) 查看完整評論
[回復] 2游客   打分:100 分  發表時間:2013-01-23
· 很好,謝謝分享
[回復] 1goldfishka   打分:85 分  發表時間:2011-05-06
· Thank you very interested in everything.
秒速时时彩