Bonjour comment test si une variable existe en javascript, l'équivalent en php est isset() et empty()
merci.
var bool = maVariable || 0;
if(! bool) {
alert('Variable maVariable indéfinie');
}
else{
alert('Variable maVariable définie');
}
/**
* Cette fonction permet d'ouvrir une popup avec un format prédéfinit.
*
* @param fct Lien url vers la page a ouvrir
* @param w largeur de la popup affiché (valeur par défaut 700)
* @param h hauteur de la popup affiché (valeur par défaut 600)
*/
function openPopup(fct, w, h)
{
var width = w || 700;
var height= h || 600;
var Left=window.screen.width/2-350;
var Top=window.screen.height/2-350;
neo=window.open(fct,'openPopup','width='+width+',height='+height+',menubar=no,toolbar=yes,location=no,scrollbars=yes,directories=no,resizable=yes,statusbar=no,left='+Left+',top='+Top) ;
if(neo.window.focus){neo.window.focus();}
}if(! bool) {
alert('Variable maVariable indéfinie');
var bool = maVariable || 0;
if( bool ) // bool = true = 1 = vrai
alert('Variable maVariable définie');
else // sinon
alert('Variable maVariable indéfinie');
Combien cela coûte-t-il au total ? Quelles aides apportent l'état et les acteurs du marché pour alléger cette charge non choisie ? Tous les détails sur Commentçamarche.net.
px: quitte à être pointilleux... =p
if(typeof maVariable === 'undefined'){