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

login form do not recognize input password on chrome

本文关键字:输入 密码 chrome 识别 表单 登录      更新时间:2023-09-26

我试图从页脚修改代码,登录表单无法识别chrome上的密码
该代码在IE9.0、FF28.0、opera、safari上运行良好,只是在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='

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