scombre
New Coder
Bonjour,
Débutant en JavaScript. J'aurais voulu savoir où se trouve le souci du code ci-dessous. C'est le nombre d'articles est supérieur à 1 la valeur envoyé est correct.
Si l'article est égal à un il y a une erreur car la valeur se trouve dans Inpt3.value (l'index n'est pas pris en consideration!
Merci d'avance de votre aide
Stéphane
English translation:
Hello,
Beginner in JavaScript. I would have liked to know where is the concern of the code below. It is the number of items is greater than 1 the value sent is correct.
If the article is equal to one there is an error because the value is in Inpt3.value (the index is not taken into consideration!
Thank you in advance for your assistance
Stephane
Translated with Google Translate. Translation may not be accurate.
Débutant en JavaScript. J'aurais voulu savoir où se trouve le souci du code ci-dessous. C'est le nombre d'articles est supérieur à 1 la valeur envoyé est correct.
Si l'article est égal à un il y a une erreur car la valeur se trouve dans Inpt3.value (l'index n'est pas pris en consideration!
Merci d'avance de votre aide
Stéphane
English translation:
Hello,
Beginner in JavaScript. I would have liked to know where is the concern of the code below. It is the number of items is greater than 1 the value sent is correct.
If the article is equal to one there is an error because the value is in Inpt3.value (the index is not taken into consideration!
Thank you in advance for your assistance
Stephane
Translated with Google Translate. Translation may not be accurate.
PHP:
<?
$nbArticles=1;
for ($i=0 ;$i < $nbArticles ; $i++)
{ ?>
<div class="media-body">
<input id="lInpt3" name="lInpt3[<?php echo $i ?>]" value="<? echo "valeur ".$i?>"><BR><br>
<input onchange=CartUpdate(<? echo $i ?>) align="right" class="form-control" type="number" id="qI" name="qI[<? echo $i ?>]" value="<? echo htmlspecialchars($_SESSION['panier']['qteProduit'][$i]) ?>"><? echo $i ?></span>
</div>
<? }?>
<script>
function CartUpdate(index){
alert(lInpt3[index].value);
};
</script>
Last edited by a moderator: