getElementById marche pour ff mais pas pour IE7
Bonjour à tous,
j'ai un petit soucis avec le document.getElementById.
Voici mon bout de code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| function checkPicOK(partID)
{
alert("checkPicOK");
alert(document.getElementById("pic_main"+partID).value);
var pic_main = document.getElementById("pic_main"+partID).value;
var checkdigits = document.getElementById("checkdigits"+partID).value;
var ori_pic_main = document.getElementById("ori_pic_main"+partID).value;
var ori_checkdigits = document.getElementById("ori_checkdigits"+partID).value;
var pic = pic_main + checkdigits;
var ori_pic = ori_pic_main + ori_checkdigits;
//alert("PIC: "+pic +" ORI_PIC: "+ori_pic);
var checkPICOK = true;
if(pic != ori_pic && document.getElementById("clearPIC" + partID).value != "1")
{
//alert("Pic different from ori pic");
if(document.getElementById("getPicOK"+partID).value == "no" || document.getElementById("getPicOK"+partID).value == "")
{
if(confirm("A Pic number has been provided but the 'Get Pic Info' Button has not been clicked.\n"+
"Click 'OK' to update and ignore the PIC number - no PIC information shall be retrieved.\n"+
"Click 'Cancel' to return to Proposal Setup - no update shall take place."))
{
document.getElementById("pic_main"+partID).value = ori_pic_main;
document.getElementById("checkdigits"+partID).value = ori_checkdigits;
}
else checkPICOK = false;
}
}
return checkPICOK;
} |
Si par malheur la valeur de partID == "" c'est à dire si elle est vide, mon code marche toujours sous ff mais pas sous IE7.
Je ne comprends pas pourquoi. :?
Mais bon je ne m'étonne plus de rien avec les différents browser :lol:
J'avais pensé tout bêtement faire un check sur partID et dupliquer le code dans le if et else en retirant le "+partID" dans chaque getElementById. Mais je ne trouve pas ça très propre. :?
Si vous avez une solution elle est la bienvenue.
D'avance merci pour vos réponses. :wink: