Javascript problème de compatibilite IE FireF
bbibi
-
bbibi Messages postés 7 Date d'inscription Statut Membre Dernière intervention -
bbibi Messages postés 7 Date d'inscription Statut Membre Dernière intervention -
Bonjour à tous et toutes,
J'ai un petit script java script qui fonctionne parfaitement sur IE mais pas sur Firefox il m'affiche NaN dans le champ:
document.form1.total.value
voici le script:
function calculer()
{
var tot=0;
var toport=0;
var quantite=0;
var totfin=0;
var totdevise=0;
if (document.form1.currency_code.options.value == "EUR")
{
toport=document.form1.port.options.value;
totdevise=5.95;
document.form1.amount.value="5.95";
}
else
{
toport=document.form1.port.options.value*1.60;
totdevise=9.90;
document.form1.amount.value="9.90";
}
quantite=document.form1.quantity.options.value;
tot=totdevise*quantite;
tot=Math.round(tot*100)/100;
toport=Math.round(toport*100)/100;
document.form1.shipping.value=toport
document.form1.total.value=tot + " + port " + toport ;
totfin=tot+parseInt(toport);
document.form1.total.value=totfin;
}
je rame complètement
merci de votre aide - à bientôt
J'ai un petit script java script qui fonctionne parfaitement sur IE mais pas sur Firefox il m'affiche NaN dans le champ:
document.form1.total.value
voici le script:
function calculer()
{
var tot=0;
var toport=0;
var quantite=0;
var totfin=0;
var totdevise=0;
if (document.form1.currency_code.options.value == "EUR")
{
toport=document.form1.port.options.value;
totdevise=5.95;
document.form1.amount.value="5.95";
}
else
{
toport=document.form1.port.options.value*1.60;
totdevise=9.90;
document.form1.amount.value="9.90";
}
quantite=document.form1.quantity.options.value;
tot=totdevise*quantite;
tot=Math.round(tot*100)/100;
toport=Math.round(toport*100)/100;
document.form1.shipping.value=toport
document.form1.total.value=tot + " + port " + toport ;
totfin=tot+parseInt(toport);
document.form1.total.value=totfin;
}
je rame complètement
merci de votre aide - à bientôt
A voir également:
- Javascript problème de compatibilite IE FireF
- Compatibilite windows 11 - Guide
- Telecharger javascript - Télécharger - Langages
- Ie tab - Télécharger - Outils pour navigateurs
- Ie 11 - Télécharger - Navigateurs
- Pack compatibilité office 2003 - Télécharger - Bureautique
6 réponses
Évite les document.form1.total.value, ça t'évitera beaucoup de soucis.
Utilise les méthodes getElementById() ou getElementByName()
document.getElementById("total").value si total est un id, sinon l'autre méthode
Utilise les méthodes getElementById() ou getElementByName()
document.getElementById("total").value si total est un id, sinon l'autre méthode
Hello bizu53
J'ai modifié mon code comme tu me l'as indiqué ... il affice zéro.......
Je rame merci de m'aider
bonne nuit
Bbibi
voici le code
function calculer(){
var tot=0;
var toport=0;
var quantite=0;
var totfin=0;
var totdevise=0;
if (document.getElementById("form1.currency_code.options.value") == "EUR") {
toport=document.getElementById("form1.port.options.value");
totdevise=5.95;
document.form1.amount.value="5.95";
}
else {
toport=document.getElementById("form1.port.options.value")*1.60;
totdevise=9.90;
document.form1.amount.value="9.90";
}
quantite=document.getElementById("form1.quantity.options.value");
tot=totdevise*quantite;
tot=Math.round(tot*100)/100;
toport=Math.round(toport*100)/100;
document.form1.shipping.value=toport
document.form1.total.value=tot + " + port " + toport ;
totfin=tot+parseInt(toport);
document.form1.total.value=totfin;
}
J'ai modifié mon code comme tu me l'as indiqué ... il affice zéro.......
Je rame merci de m'aider
bonne nuit
Bbibi
voici le code
function calculer(){
var tot=0;
var toport=0;
var quantite=0;
var totfin=0;
var totdevise=0;
if (document.getElementById("form1.currency_code.options.value") == "EUR") {
toport=document.getElementById("form1.port.options.value");
totdevise=5.95;
document.form1.amount.value="5.95";
}
else {
toport=document.getElementById("form1.port.options.value")*1.60;
totdevise=9.90;
document.form1.amount.value="9.90";
}
quantite=document.getElementById("form1.quantity.options.value");
tot=totdevise*quantite;
tot=Math.round(tot*100)/100;
toport=Math.round(toport*100)/100;
document.form1.shipping.value=toport
document.form1.total.value=tot + " + port " + toport ;
totfin=tot+parseInt(toport);
document.form1.total.value=totfin;
}
hello
je rame tjours .....
currency_code est l'ID d'un select
cette syntaxe est-elle juste ?
if (document.form1.getElementById("currency_code").options.value == "EUR"){
...........
merci d'avance
A+
je rame tjours .....
currency_code est l'ID d'un select
cette syntaxe est-elle juste ?
if (document.form1.getElementById("currency_code").options.value == "EUR"){
...........
merci d'avance
A+
document.getElementById(....
Pour ce qui est de la fin (un .options) pour un select je n'affirme rien parce que je n'ai pas l'habitude d'en manipuler mais ça ne me paraît pas incorrect. 2sec je teste ;)
Rectification : il n'y a pas non plus .options
Par exemple :
<select id="liste">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<input type="button" value="Affiche" onclick="javascript:alert(document.getElementById('liste').value);">
Pour résumer :
if (document.getElementById("currency_code").value == "EUR"){
Pour ce qui est de la fin (un .options) pour un select je n'affirme rien parce que je n'ai pas l'habitude d'en manipuler mais ça ne me paraît pas incorrect. 2sec je teste ;)
Rectification : il n'y a pas non plus .options
Par exemple :
<select id="liste">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<input type="button" value="Affiche" onclick="javascript:alert(document.getElementById('liste').value);">
Pour résumer :
if (document.getElementById("currency_code").value == "EUR"){
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
MERCI beaucoup Bizu53
ca marche impec ...
tu m'enlèves une grosse épine du pied...
Si j'osais une autre question ... ?
pour connecter deux portables ensemble en wifi comment faire ? j'ai lu pas mal de tuto mais trop complexe pour mon cas "tout simple" .....
ma config :
modem----------routeur port 1 -> ordi portable1
que faire pour pour le portable 2 ( le configurer sur le port 1 ou 2 du routeur )?
et ensuite....?
Si tu px m'aider merci d'avance
A lundi
ca marche impec ...
tu m'enlèves une grosse épine du pied...
Si j'osais une autre question ... ?
pour connecter deux portables ensemble en wifi comment faire ? j'ai lu pas mal de tuto mais trop complexe pour mon cas "tout simple" .....
ma config :
modem----------routeur port 1 -> ordi portable1
que faire pour pour le portable 2 ( le configurer sur le port 1 ou 2 du routeur )?
et ensuite....?
Si tu px m'aider merci d'avance
A lundi