JavaScript: style.background breaks my code

0

I have a JavaScript code that works for me until I add another part of the code. That is, the part of 'DECRECER' works perfectly until I add the other part of the code ('VALIDATING')

// --------------------------------------------- --------------------------------DECREASE----------------- -----------------------------------------------

var imagenes = new Array(2);

function ejecutar2(){

    for (var i=0; i<3; i++) {
        imagenes[i]=document.getElementsByTagName("img")[i];
        imagenes[i].addEventListener("mouseover", crecer, false);
        imagenes[i].addEventListener("mouseout", decrecer, false);
    }

}


function crecer(){

    this.width=600;
    this.height=400;

}

function decrecer(){

    this.width=250;
    this.height=250;

}

// --------------------------------------------- -------------------------------------------------- -------------------------------------------------

// --------------------------------------------- --------------------------------- VALIDATING ---------------- ------------------------------------------

function validando(){

    document.getElementsByTagName("mi_formulario").addEventListener("invalid", validar, false);

    document.getElementById("enviar").addEventListener("click", enviar, false);

    //document.getElementsByTagName("mi_formulario").addEventListener("input", validar_tiempo_real, false);

}

function validar(e){

    var elemento = e.target;

    elemento.style.background = #FFDDDD;

}

function enviar(){

    var correcto = document.mi_formulario.checkValidity();

    if(correcto == true){
        document.mi_formulario.submit();
    }

}

// --------------------------------------------- -------------------------------------------------- --------------------------------------------------

window.addEventListener("load", ejecutar2, false);

window.addEventListener("load", validando, false);
    
asked by Daniel Agudelo 22.07.2018 в 02:41
source

0 answers