javascript 建設銀行登陸鍵盤_javascript技巧

來源:互聯網
上載者:User
複製代碼 代碼如下:

/******************************************************
//      *功能描述:把密碼輸入控制項寫入頁面中
//      *參數說明:
//        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();            

        }

    }

}

線上示範
打包檔案下載

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.