Bonjour tout le monde,
j'utilise 2 fonctions js pour alimenter un champ de date 'année' selon si le formulaire et journalier ou periodique, la fonction pour alimenté les années en mode journalier est la suivante :
la foction pour l'ailimenter en mode periodique est la suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 function populate1(objForm,selectIndex) { timeA = new Date(objForm.year.options[objForm.year.selectedIndex].text, objForm.month.options[objForm.month.selectedIndex].value,1); timeDifference = timeA - 86400000; timeB = new Date(timeDifference); var daysInMonth = timeB.getDate(); for (var i = 1; i <= daysInMonth; i++) { objForm.day.options[1] = null; } for (var i = 1; i <= daysInMonth; i++) { objForm.day.options[i] = new Option(i); objForm.day.options[i].value=i; } objForm.day.options[1].selected = true; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 function populate(objForm,selectIndex,allLabel) { timeA = new Date(objForm.year.options[objForm.year.selectedIndex].text, objForm.month.options[objForm.month.selectedIndex].value,1); timeDifference = timeA - 86400000; timeB = new Date(timeDifference); var daysInMonth = timeB.getDate(); for (var i = 0; i <= daysInMonth; i++) { objForm.day.options[0] = null; } if (objForm.month.selectedIndex==0) { for (var i = 0; i <= daysInMonth;i++) { objForm.day.options[0] = null;} objForm.day.options[0]=new Option(allLabel,0); objForm.day.options[0].selected = true; } else { objForm.day.options[0]=new Option(); objForm.day.options[0].text =allLabel; for (var i = 1; i <= daysInMonth; i++) objForm.day.options[i] = new Option(i); objForm.day.options[0].selected = true; } }
mon probleme c 'est que àa marche parfait sur IE mais pour Firefox la partie journaliere n'affiche pas les années correctement, par exemple, à la place de 2003 j'ai 103.
quelqu'un a une idée de quoi ça peut venir.
merci par avance de votre aide.
Partager