Javascript Construction Bank login keyboard _ javascript skills

Source: Internet
Author: User
Enter the password on the javascript simulated keyboard The Code is as follows:


/*************************************** ***************
// * Function Description: Write the password input control to the page.
// * Parameter description:
// InputCtlName: name of the original control
//
// Creation date: 2006-07-24
**************************************** **************/
Var InputControlAreaIndex = 0;
Var InputControlAreaPubKey = '';
Var InputControlAreaAccVer = "115A7165-DE06-49B8-9850-15414C233E83: 1009 ";
Var InputControlAreaFlag = "1 ";
Var InputControlAreaAccVerFlag = false;
Var InputControlAreaArray = new Array ();
Function InputControlArea (inputName, type ){

// Initialize the control label
Var input = document. all [inputName];
// Initialize the soft keyboard
// This. initKeyBoard (input );
// Determine whether the control is enabled
If (input = null | arguments. length! = 2 | (InputControlAreaFlag! = 2 & InputControlAreaFlag! = 3 )){

This. obj = false;
Return;

}
// Generate control labels
This. init ("Sec." + inputName, inputName );

// Obtain valid controls
Var returnObject = this. getInputCtl (document. all ["Sec." + inputName], type );

// Display valid controls
This. obj = this. displayInput (returnObject, document. all [inputName]);

InputControlAreaArray [InputControlAreaArray. length] = this. obj;


}

InputControlArea. prototype. initKeyBoard = function (input ){

If (InputControlAreaFlag = 3 | InputControlAreaFlag = 1)
{

Input. onkeydown = function (){

Calc. password. value = this. value;

}
Input. onchange = function (){

Calc. password. value = this. value;

}
Input. onclick = function (){

Password1 = this;
Showkeyboard ();
This. readOnly = 1;
Calc. password. value = '';

}

} Else if (InputControlAreaFlag = 2 | InputControlAreaFlag = 0)
{

Input. onkeydown = null;
Input. onchange = null;
Input. onclick = null;

}

}

InputControlArea. prototype. init = function (inputCtlId, inputName ){

// Call the control appended to the end of the function.
Function writeInputControl (clsid, id ){

// Generate control labels
Var classid = "";
If (clsid! = "")
{

Classid = "classid = 'clsid:" + CLSID + "'";

}

InputSpan + =''+'';

}
Var inputSpan = document. all [inputName]. outerHTML +"

";
WriteInputControl ("", inputCtlId );
//
Var strCtls = InputControlAreaAccVer. split (",");
For (var I = 0; I
{

WriteInputControl (strCtls [I]. split (":") [0], inputCtlId );
// Control


}
//////////////////////////////////////// ///////////////////////////////
InputSpan + = '';
InputSpan + ="

";
Document. all [inputName]. outerHTML = inputSpan;

}

InputControlArea. prototype. displayInput = function (returnObj, input ){

// The control is valid.
If (returnObj. classid! = "")
{

Input. style. display = "none ";
ReturnObj. style. display = "";
Document. all [returnObj. id + "img"]. style. display = "";
Document. all [input. name + "Area"]. style. display = "inline ";
ReturnObj. onblur = function (){

// Determine whether the processing exists when the focus is removed
If (input. onblur)
{

Input. onblur. call ();

}
// Set the password
// Input. value = returnObj. GetPassword (InputControlAreaPubKey );
// ReturnObj. length = returnObj. GetLength ();

}
ReturnObj. onDoSubmit = function (){

Input. value = returnObj. GetPassword (InputControlAreaPubKey );
ReturnObj. length = returnObj. GetLength ();

}

If (InputControlAreaPubKey = '')
{

InitOnSubmit ();
InputControlAreaPubKey = returnObj. GetPubKey (InputControlAreaPubKey );

}
ReturnObj. SetFunName (input. name );

} Else {

// The control is invalid.
Input. style. display = "";
ReturnObj = false;
If (window. location. toString (). indexOf ("LOGIN") =-1)
{

Return;

}
Var warning;
If (InputControlAreaAccVerFlag)
{

Warning = "the version of the control entered with your password is invalid. Do you want to install the new version? ";

}
Else
{

Warning = "You have not installed the password input control. Are you sure you want to install it? ";

}


Var SetUpFlag = this. GetCookie ("SetUpFlag ");
Var returnFlg = this. GetCookie ("returnFlg ");
If (returnFlg = "1 ")
{

This. SetCookie ("returnFlg", "0 ");
Return;

}
If (SetUpFlag! = "0" | SetUpFlag = null)
{

This. SetCookie ("SetUpFlag", "1 ");
Top. location = "/app/B2CMainPlatV5? CCB_IBSVersion = V5 & CUSTYPE = 0 & TXCODE = 801002 ";

}


}
// Return valid controls
Return returnObj;

}

InputControlArea. prototype. getInputCtl = function (inputCtls, type ){

Var validSE = 0;

For (var I = inputCtls. length-1; I> = 1; I --){

Try {

If (InputControlAreaAccVer. indexOf (inputCtls [I]. GetVersion () =-1 ){

InputControlAreaAccVerFlag = true;
Continue;

}
InputCtls [I]. SetCryptFlag (type );
ValidSE = I;
Break;

} Catch (e ){

// Continue;

}
Try {

InputCtls [I]. GetStrMsg ();
ValidSE = I;
Break;

} Catch (e ){

Continue;

}

}
InputControlAreaIndex = validSE;
Return inputCtls [validSE];

}

Function callOnBlurByName (inputCtlName ){

Document. all ["Sec." + inputCtlName] [InputControlAreaIndex]. onblur. call ();

}

InputControlArea. prototype. SetCookie = function (sName, sValue)
{

Document. cookie = sName + "=" + escape (sValue) + "; expires = Fri, 31 Dec 2999 23:59:59 GMT ;";

}

// Retrieve the value of the cookie with the specified name.
InputControlArea. prototype. GetCookie = function GetCookie (sName)
{

// Cookies are separated by semicolons
Var aCookie = document. cookie. split (";");
For (var I = 0; I {

// A name/value pair (a crumb) is separated by an equal sign
Var aCrumb = aCookie [I]. split ("= ");
If (aCrumb [0]. indexOf (sName )! =-1 ){

Return unescape (aCrumb [1]);

}

}
// A cookie with the requested name does not exist
Return null;

}

Function initOnSubmit (){


For (var I = 0; I

Var submitHandler = document. forms [I]. onsubmit;

If (submitHandler ){

Document. forms [I]. onsubmit = function (){

InitPassWord ();
Return submitHandler. call ();

}

}


}

}


Function initPassWord (){

For (var I = 0; I

If (InputControlAreaArray [I]! = Null & InputControlAreaArray [I]. onDoSubmit! = Null)
{

InputControlAreaArray [I]. onDoSubmit. call ();

}

}

}


Online Demo
Package File Download

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.