2013年11月14日星期四

java analog form login page From there onsubmint attribute prevents the automatic submission

How to handle this onsubmint the program can automatically login

<form name="login" action="redirct_index.htm" method="post" onsubmit="return formSubmit2(this);">



function formSubmit2()
{
    var oUserName = document.getElementById("userName");
    var oPassword = document.getElementById("password");
    if (1 == vldcode_en)
    {
        var oVldcode = document.getElementById("vldcode");
    }

    if (0 == oUserName.value.length)
    {
        document.getElementById("messages").innerHTML="请输入用户名!";
        oUserName.focus();
        return false;
    }
    /*
    if (0 == oPassword.value.length)
    {
        document.getElementById("messages").innerHTML="请输入密码!";
        oPassword.focus();
        return false;
    }
    */
    if(!checkStringChar(oPassword,' '))
    {
        document.getElementById("messages").innerHTML="密码不能包含空格!";
        oPassword.focus();
        return false;
    }

    oUserName.value = trim(oUserName.value);
    //oPassword.value = trim(oPassword.value);

    if (1 == vldcode_en)
    {   
        oVldcode.value  = trim(oVldcode.value);

        if ( oVldcode.value == "" )
        {
            document.getElementById("messages").innerHTML="请输入验证码!";
            if (1 == mapOvertime)
            {
                get_vldbmp();
            }
            else
            {
                oVldcode.focus();
            }
            return false;
        }
        else if (1 == mapOvertime)
        {
            document.getElementById("messages").innerHTML="验证码已超时,请重新输入!";
            get_vldbmp();
            return false;
        }
        else if (!/(^[a-zA-Z0-9]{4}$)/.test(oVldcode.value)) 
        {
            document.getElementById("messages").innerHTML="验证码错误!";
            return false; 
        }
    }
    
    set_cookie("userName", escape(oUserName.value), null, "/");
    set_cookie("password", oPassword.value, null, "/");
    if (1 == vldcode_en)
    {
        set_cookie("vldcode", oVldcode.value, null, "/");
    }
    
    var d = new Date;
    document.login.rtime.value = (d.getTime() / 500);
    
    return true;
}



var copyright_time="2008-2013";
var deviceName =  "H3C S1626"; 
var messages = "";
var vldcode_en = 0;


vldcode = 0 indicates no authentication code, the rest is the user name and password , and I fill in the user name and password, and the result was 401


------ Solution ------------------------------------ --------
placed directly inside the page load event can not do ?
------ Solution ---------------------------------------- ----

  
How to put ?   You certainly inside the text box to enter data, then how do you then automatically submit ? Textbox trigger event , triggered the corresponding cursor leaves the js function , a little Meinong Dong you mean !
------ For reference only -------------------------------------- -
wooden people ah ?
------ For reference only -------------------------------------- -


How to put ?
------ For reference only -------------------------------------- -

    
How to put ?        You certainly inside the text box to enter data, then how do you then automatically submit ? Textbox trigger event , triggered the corresponding cursor leaves the js function , a little Meinong Dong you mean !  

Thank you, I have done, use HTMLUNIT. This should slow down , but with the bad. Results posted .
------ For reference only -------------------------------------- -
with Onload
------ For reference only -------------------------------- -------
? ? ?

没有评论:

发表评论