vendredi 3 mars 2017

Javascript | Why is this function "useless / infinite" It cant win, per say

I've been working on a Login System with 2auth. I'm attempting this but it seems to be useless, and will not execute the last else, due to the variable changing, I have no idea why i have this "Jam", It's really annoying, Any ideas?

function showorunshow(){
var d = false
if (d){
    document.getElementById("Two_Factor_Show_Button").className = "btn btn-danger text-uppercase btn-labeled fa fa-square-o"; // changing
    document.getElementById("TF_Holder").className = "form-group hidden";   
    d = false //ReAssigngs correct value
}
if (d == false){
document.getElementById("Two_Factor_Show_Button").className = "btn btn-danger text-uppercase btn-labeled fa fa-check-square-o"; //changing image
    document.getElementById("TF_Holder").className = "form-group";  
    d = true
}
};

Aucun commentaire:

Enregistrer un commentaire