mercredi 7 octobre 2015

setting variabels inside functions and use it oustide - javascript

I have this code, I want to set the variabel and if function clickButton performed I want the the variable to be set and later used in if().

Can´t get this to work...

var clickButton_1_var = 0;

function clickButton_1() 
{
        clickButton_1_var = 1;

}

if (clickButton_1_var == 1)

{
        document.write("Hello World!");
}

Aucun commentaire:

Enregistrer un commentaire