javascript 建设银行登陆键盘


/******************************************************
//      *功能描述:把密码输入控件写入页面中
//      *参数说明:
//        inputCtlName:原控件名
//        
//        创建日期: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){

    //初始化控件标签
    var input=document.all[inputName];    
    //初始化软键盘
    //this.initKeyBoard(input);
    //判断控件是否启用
    if(input==null||arguments.length!=2||(InputControlAreaFlag!=2&&InputControlAreaFlag!=3)){

        this.obj=false;        
        return ;        

    }
    //生成控件标签
    this.init("Sec."+inputName,inputName);    

    //取得有效控件
    var returnObject=this.getInputCtl(document.all["Sec."+inputName],type);    

    //显示有效控件
    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){

    //在函数末尾追加的控件,先调用。
    function writeInputControl(clsid,id){

        //生成控件标签
        var classid="";        
        if(clsid!="")
        {

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

        }

        inputSpan+='<OBJECT '+classid+' id='+id+' VIEWASTEXT style="display:none" size="20" width="100" height="17">'+'</OBJECT>';        

    }
    var inputSpan=document.all[inputName].outerHTML+"<div id = '"+inputName+"Area' style = 'border:1px solid #69c;padding:0;vertical-align:top;width:148;height=17;display:none'>";    
    writeInputControl("",inputCtlId);
    //
    var strCtls=InputControlAreaAccVer.split(",");    
    for(var i=0;i<strCtls.length;++i)
    {

        writeInputControl(strCtls[i].split(":")[0],inputCtlId);
        //控件A

        
    }
    ///////////////////////////////////////////////////////////////////////
    inputSpan+='<img id='+inputCtlId+"img"+' SRC="images/icon_small_hand.gif" ALT="已使用密码输入控件,方便您的密码输入!" width=16 height=17 style = "vertical-align:top;display:none" ></img>';    
    inputSpan+="</div>";    
    document.all[inputName].outerHTML=inputSpan;    

}

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

    //控件有效
    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 (){

            //判断离开焦点时的处理是否存在
            if(input.onblur)
            {

                input.onblur.call();                

            }
            //设置密码
            //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 {

        //控件无效
        input.style.display="";        
        returnObj=false;        
        if((window.location.toString ()).indexOf("LOGIN")==-1)
        {

            return ;            

        }
        var warning;        
        if(InputControlAreaAccVerFlag)
        {

            warning="您的密码输入控件版本无效,是否安装新版本?";            

        }
        else 
        {

            warning="您未安装密码输入控件,是否安装?";            

        }

        
        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 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<aCookie.length;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<document.forms.length;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<InputControlAreaArray.length;i++){

        if(InputControlAreaArray[i]!=null&&InputControlAreaArray[i].onDoSubmit!=null)
        {

            InputControlAreaArray[i].onDoSubmit.call();            

        }

    }

}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjzpgw.html