Modification d'une variable non prise en compte
Bonjour,
voici un exemple de mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
function affiche() {
newCellule.className='td';
var text=document.createTextNode(tousTotal);
<snip>
}
function listeJeu(){
var tousTotal;
function cacahouette() {
tousTotal=5;
}
function affiche(); |
cela affiche undefined.
Ors, si je fait
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
function affiche() {
newCellule.className='td';
var text=document.createTextNode(tousTotal);
<snip>
}
function listeJeu(){
var tousTotal;
function cacahouette() {
tousTotal=5;
}
alert(tousTotal);
function affiche(); |
Ça affiche bien 5.
Une idée?
D'avance merci