Adding "use strict" to this function is breaking it. Specifically the inputs I am trying to un-disable are remaining disabled in strict mode. csc_popup_in() and csc_popup_out() functions are defined prior to this one. Thanks in advance for any input.

function show_cc(){
    document.getElementById('cc_fade').className='none';

    var cc_inps = document.getElementById('cc_fade').getElementsByTagName('input');
    for(i=0 ; i<cc_inps.length ; i++){
        cc_inps[i].disabled=false;
    }

    document.getElementById('csclnk').onmouseover = function(){csc_popup_in();};
    document.getElementById('csclnk').onmouseout = function(){csc_popup_out();};

    if(document.getElementById('amex').checked){
        document.getElementById('cc_num').maxLength = 15;
        document.getElementById('cc_csc').maxLength = 4;
    } else {
        document.getElementById('cc_num').maxLength = 16;
        document.getElementById('cc_csc').maxLength = 3;
    }
}
有帮助吗?

解决方案

You forgot to declare "i" with var!!!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top