-4

您好我正在尝试更改一个<div>框,因为访问者点击了一些链接。现在这并没有按应有的方式工作。对此的任何帮助将不胜感激,并在此先感谢您。

    //Tab Open events
$("#signUp").click(function(e){
    OpenTabs("#SignUpBox");
});
$("#ForgetPassword").click(function(e){
    OpenTabs("#PasswordResetBox");
});
function OpenTabs(CssId) {

    if(CssId="#SignUpBox"){
        ResetPanelsTo("#SignUpBox");
        ResizePanelTo("#SignUpBox");
        console.log("in if(CssId='#SignUpBox'){");
    }
    if(CssId="#loginBox"){
        ResetPanelsTo("#loginBox");
        ResizePanelTo("#loginBox");
        console.log("in if(CssId='#loginBox'){");
    }
    if(CssId="#PasswordResetBox"){
        ResetPanelsTo("#PasswordResetBox");
        ResizePanelTo("#PasswordResetBox");
        console.log("in if(CssId='#PasswordResetBox'){");
    }
    function ResetPanelsTo(CssId){
        if(CssId="#SignUpBox"){
            $("#PasswordResetBox").css("display","none");
            $("#SignUpBox").css("display","block");
            $("#loginBox").css("display", "none");
            console.log("ResetPanelsTo SignUpBox");
        }
        if (CssId="#PasswordResetBox"){
            $("#SignUpBox").css("display","none");
            $("#PasswordResetBox").css("display","block");
            $("#loginBox").css("display", "none");
            console.log("ResetPanelsTo PasswordResetBox");
        }
        if (CssId="#loginBox"){
            $("#SignUpBox").css("display","none");
            $("#PasswordResetBox").css("display","none");
            $("#loginBox").css("display", "block");
            console.log("ResetPanelsTo loginBox");
        }
    }

    function ResizePanelTo(CssId) {
        if (CssId = "#SignUpBox") {
            $(".panel").css({
                left: "531px",
                top: "-90px",
                width: "360px",
                height: "350px",
                'border-radius': '5px'
            });
            console.log("ResizePanelTo SignUpBox");
        }

        if (CssId = "#PasswordResetBox") {
            $(".panel").css({
                left: "531px",
                top: "-90px",
                width: "360px",
                height: "110px",
                'border-radius': '5px'
            });
            console.log("ResizePanelTo panel");
        }

        if (CssId = "#loginBox"){
                $(".login_panel").css({ left: "0px", top: "0px", width: "220px", height: "161px", background: "#f4f4f4", 'border-radius': '0' });
                console.log("ResizePanelTo login_panel");
        }
        }

    }
4

1 回答 1

3

你所有的“如果”都是坏的

它的 :

if(CssId == "#..."){ 

不是 :

if(CssId = "#..."){

“=”不像“==”

于 2013-07-31T13:50:33.383 回答