首页 新闻 会员 周边 捐助

推荐个可实现弹出一个层然后在层上做登录,登录后刷新背景窗体的例子

0
悬赏园豆:30 [已解决问题] 解决于 2008-10-14 13:49

要求:尽量小,兼容流行浏览器。submodel我看了,一般。有啥好的没?

数据绑定者的主页 数据绑定者 | 初学一级 | 园豆:160
提问于:2008-10-13 15:27
< >
分享
最佳答案
0

<!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 src="Script/jQueryLibs/jquery.js" type="text/javascript"></script>

    <script src="Script/jQueryLibs/jquery.blockUI.js" type="text/javascript"></script>

    <script src="Script/jQueryLibs/jquery.hotkeys.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
        $(document).ready(function() {
            jQuery.hotkeys.add('return', function() {
                $('#Submit').click();
            });
            $('#UserName').focus();
            $('#Reg').click(function() {
                $.blockUI({
                    message: $('#RegBox')
                })
            })
            $('#RegSubmit').click(function() {
                var RegUserName = $.trim($('#RegUserName').val());
                var RegPassWord = $.trim($('#RegPassWord').val());
                var RegEmail = $.trim($('#RegEmail').val());
                var RegMobilePhone = $.trim($('#RegMobilePhone').val());
                if (RegUserName == '' || RegPassWord == '' || RegEmail == '') return;
                $.ajax({
                    url: '/WebService/ToJson.ashx?Torrent=Reg',
                    type: 'POST',
                    data: 'UserName=' + RegUserName + '&PassWord=' + RegPassWord + '&Email=' + RegEmail + '&MobilePhone=' + RegMobilePhone,
                    success: function(msg) {
                        $.blockUI({
                            message: msg == "true" ? "注册成功,正在转入管理平台" : "注册失败,帐号名或信息地址有重复"
                        });
                        window.setTimeout(function() {
                            $.unblockUI();
                            if (msg == "true")
                                location.href = "Torrent/JQuery.htm"
                        }, 1000);
                    }
                })
            })
            $('#Submit').click(function() {
                var UserName = $.trim($('#UserName').val());
                var PassWord = $.trim($('#PassWord').val());
                if (UserName == '' || PassWord == '') return;
                $.blockUI({
                    message: '正在登陆'
                });
                $.ajax({
                    url: '/WebService/ToJson.ashx?Torrent=Login',
                    type: 'POST',
                    data: 'UserName=' + UserName + '&PassWord=' + PassWord,
                    success: function(msg) {
                        $.blockUI({
                            message: msg == "true" ? "验证通过" : "验证失败"
                        });
                        window.setTimeout(function() {
                            $.unblockUI();
                            if (msg == "true")
                                location.href = "Torrent/JQuery.htm"
                        }, 1000);
                    }
                })
            })
        })
    </script>

</head>
<body>

    <div id="middle">
        <div id="LoginBox" style="margin: 0 auto; text-align: center; width: 930px;">
            <ul>
                <li>
                    <label>
                        帐号</label><input id="UserName" size="22" type="text" /></li>
                <li>
                    <label>
                        密码</label><input id="PassWord" size="22" type="password" /></li>
                <li>
                    <input id="Submit" type="button" value="登陆" />
                    <input id="Reg" type="button" value="注册" /></li>
            </ul>
        </div>
        <div id="RegBox" style="display: none; width: 220px; text-align: left">
            <ul>
                <li>
                    <label>
                        帐号</label><input id="RegUserName" type="text" size="22" /></li>
                <li>
                    <label>
                        密码</label><input id="RegPassWord" type="password" size="22" /></li>
                <li>
                    <label>
                        邮箱</label><input id="RegEmail" type="text" size="22" /></li>
                <li>
                    <label>
                        手机</label><input id="RegMobilePhone" type="text" size="22" /></li>
                <li style="text-align: center">
                    <input id="RegSubmit" type="button" value="提交" /><input type="button" value="取消"
                        onclick='$.unblockUI()' /></li>
            </ul>
        </div>
    </div>

</body>
</html>

StarZ | 菜鸟二级 |园豆:270 | 2008-10-13 15:43
其他回答(5)
0

用jquery的dialog做,刷新是通过location = location来做

Gray Zhang | 园豆:17610 (专家六级) | 2008-10-13 15:41
0

thickbox

wingoo | 园豆:1513 (小虾三级) | 2008-10-13 16:15
0
RicoRui | 园豆:3663 (老鸟四级) | 2008-10-13 17:44
0

这么简单的东西,自己动手吧

Jeremy Liu | 园豆:705 (小虾三级) | 2008-10-13 17:50
0

顶一下。。 不错

jquery

CarlZeng | 园豆:205 (菜鸟二级) | 2008-10-13 22:49
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册