Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我的下拉登录框有问题吗?_Javascript_Jquery - Fatal编程技术网

Javascript 我的下拉登录框有问题吗?

Javascript 我的下拉登录框有问题吗?,javascript,jquery,Javascript,Jquery,我有一个简单的Jquery脚本,它允许我放置一个漂亮的下拉登录框,但我有一个简单的问题 当我试图放置超过1个框时,让我们说5个,脚本完全混乱了 我相信这与DIV id和复制有关,但我没有找到解决这个问题的方法 JS代码 // Login Form $(function() { var button = $('#loginButton'); var box = $('#loginBox'); var form = $('#loginForm'); button.r

我有一个简单的Jquery脚本,它允许我放置一个漂亮的下拉登录框,但我有一个简单的问题 当我试图放置超过1个框时,让我们说5个,脚本完全混乱了 我相信这与DIV id和复制有关,但我没有找到解决这个问题的方法

JS代码

// Login Form

$(function() {
    var button = $('#loginButton');
    var box = $('#loginBox');
    var form = $('#loginForm');
    button.removeAttr('href');
    button.mouseup(function(login) {
        box.toggle();
        button.toggleClass('active');
    });
    form.mouseup(function() { 
        return false;
    });
    $(this).mouseup(function(login) {
        if(!($(login.target).parent('#loginButton').length > 0)) {
            button.removeClass('active');
            box.hide();
        }
    });
});
html代码

<!doctype html>
<html>
<head>
    <meta charset="utf8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>jQuery Dropdown Login Freebie | The Finished Box</title>
    <link rel="stylesheet" href="css/style.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js?ver=1.4.2"></script>
    <script src="js/login.js"></script>
</head>
<body>
    <div id="bar">
        <div id="container">
            <!-- Login Starts Here -->
            <div id="loginContainer">
                <a href="#" id="loginButton"><span>Login</span><em></em></a>
                <div style="clear:both"></div>
                <div id="loginBox">                
                    <form id="loginForm">
                        <fieldset id="body">
                            <fieldset>
                                <label for="email">Email Address</label>
                                <input type="text" name="email" id="email" />
                            </fieldset>
                            <fieldset>
                                <label for="password">Password</label>
                                <input type="password" name="password" id="password" />
                            </fieldset>
                            <input type="submit" id="login" value="Sign in" />
                            <label for="checkbox"><input type="checkbox" id="checkbox" />Remember me</label>
                        </fieldset>
                        <span><a href="#">Forgot your password?</a></span>
                    </form>
                </div>
            </div>

            <!-- Login Ends Here -->
        </div>
    </div>
</body>
</html>

jQuery下拉式登录免费|完成框
电子邮件地址
密码
记得我吗

是的,更改ID将适用于多个框。

能否提供一个失败的代码,即多个框?