登录表单无法识别chrome上的输入密码

时间:2014-04-16 18:10:13

标签: javascript php forms google-chrome passwords

我正在尝试修改页脚中的代码,并且登录表单无法识别chrome上的密码 IE9.0和FF28.0,歌剧,野生动物园的代码都可以正常运行,而不是在Chrome上 : “在你的表格中发生了错误! 请进行以下更正,

*'密码'不能为空!'

请帮忙!

// Members
$html .= '<div class="members">';
if( $_SESSION['customer_id'] ){
$html .= '<div class="footer_title">'."Customer Login".'</div>';
$html .= '<div><a href="'.gf_href_link("process_cart.php",'','SSL'). '" >'. BOX_HEADING_SHOPPING_CART .'</a></div>';
$html .= '<div><a href="'.gf_href_link("account.php",'','SSL'). '" >'. TXT_MY_ACCOUNT .'</a></div>';
$html .= '<div><a href="'.gf_href_link("logoff.php"). '" >'. TXT_LOGOUT .'</a></div>';
$html .= '<div style="height:10px;"></div>';
} else {
$html .= '<div class="footer_title" style="margin-bottom:5px;">'."Customer Login".'</div>';
$html .= '<form id="loginForm" onsubmit="return check_login()" name="loginForm" method="post" action="">';
$html .= '<div class="footer_email"><input class="email_input1" name="customer_name" type="text" value="'. TXT_ENTER_EMAIL .'" onclick="if(  this.value == '."'".TXT_ENTER_EMAIL."'". ') this.value='."''".';"></div>';
$html .= '<div class="password_login1">';
$html .= '<div class="footer_password">';
/* script */
$html .= '<script type="text/javascript">
function show_password_input(){
$("#tx").hide();
$("#pw").show();
$("#pw").attr("value","");
$("#pw").focus();
    }
</script>';
$html .= '<input class="password_input1" name="customer_password" id="tx" type="text" value="'.TXT_PASSWORD.'"  onfocus="show_password_input();">';
$html .= '<input class="password_input1" name="customer_password" id="pw" type="password" style="display:none;">';
$html .= '</div>';
$html .= '<div class="footer_login">'.gf_image_submit("btn_login.png","login", "class='login_btn1'"). '</div>';
$html .= '<div style="clear:both"></div>';
$html .= '</div>';
$html .= '</form>';
$html .= '<div style="clear:both;text-align:right;padding-right:10px;"><a href="'.gf_href_link("account.php"). '">Register</div>';
}
$html .= '</div>';




$html .= '<script language="javascript">';
        $html .= '$(window).load(function(){
            var left_height = $(".left").height();
            var center_height = $(".center").height();

            if( left_height <= center_height){
                $(".left").attr({style:"height:"+(center_height-20)+"px"});
            }
        });';

        $html .= "\n";
        $html .= 'var submitted = false;
                function check_login() {    
                var error = 0;
                var doberror = 0;
                var error_message = "'.JS_ERROR.'";

                if (submitted == true) {
                    alert("'.JS_ERROR_SUBMITTED.'");
                    return false;
                }
                var email_address = document.loginForm.customer_name.value;
                var customer_password = document.loginForm.customer_password.value;
                if (document.loginForm.elements["customer_name"].type != "hidden") {
                    if(email_address == "" || email_address == "Enter your email address" || email_address.length < '.((CFG_CUSTOMERS_EMAIL_ADDRESS)?CFG_CUSTOMERS_EMAIL_ADDRESS:'0').') {
                        error_message = error_message + "'.JS_EMAIL_ADDRESS.'";
                        error = 1;
                    }
                    else if(!validateEmail(email_address)) {
                        error_message = error_message + "* Sorry, your Email Address is invalid!";
                        error = 1;
                    }
                }
                if (document.loginForm.elements["customer_password"].type != "hidden") {
                    if(customer_password == "") {
                        error_message = error_message + "* The \'Password\' can not be empty! \r\n";
                        error = 1;
                    }
                }
                if (error == 1)
                {
                    alert(error_message);
                    return false;
                }
                else
                {
                    submitted = true;
                    document.loginForm.submit();
                    return true;
                }
            }';
        $html .= '</script>';
        $js='

1 个答案:

答案 0 :(得分:1)

您有两个名为customer_password的字段。提交表单时,输入字段的名称将用作参数名称,因此请尝试更改隐藏密码字段的名称。 您可以将其名称更改为customer_password1(对于id为“tx”的输入)