Bonjour,
J'ai un formulaire qui est un convertisseur pour prêt immobilier.
J'aimerais pouvour formater les nombres pour qu'ils séparent les milles ex:
10'000 ou 100'000 ou comme ca si c'est plus facile 100 000.
voici le code de ma page merci d'avance pour votre aide. là je sèche
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115 <script language='JavaScript'> <!-------------------------------------------------------------------- Memory = "0"; // initialise memory variable Current = "0"; // and value of Display ("current" value) Operation = 0; // Records code for eg * / etc. MAXLENGTH = 30; // maximum number of digits before decimal! function gup( name ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; } function insertNthChar(string,chr,nth) { var output = ''; for (var i=0; i<string.length; i++) { if (i>0 && i%4 == 0) output += chr; output += string.charAt(i); } return output; } function Calculate() { Current = document.Calculator.Bien.value; Current = eval(((Current * 0.8)*0.0725)/0.33) Operation = 0; Current = Current + ""; if (Current.indexOf("Infinity") != -1) { Current = "Valeur trop grande"; }; if (Current.indexOf("NaN") != -1) { Current = "Valeur incorrecte"; }; Operation = 0; //clear operation Memory = "0"; //clear memory Current = Math.round(Current); document.Calculator.Salaire.value = Current; } function Calculate2() { Current = document.Calculator.Salaire.value; Current = eval((((Current/3)/0.0725)/0.8)*1) Operation = 0; Current = Current + ""; if (Current.indexOf("Infinity") != -1) { Current = "Valeur trop grande"; }; if (Current.indexOf("NaN") != -1) { Current = "Valeur incorrecte"; }; Operation = 0; //clear operation Memory = "0"; //clear memory Current = Math.round(Current); document.Calculator.Bien.value = Current; } function FixCurrent() { Current = document.Calculator.Salaire.value; if (Current.indexOf("NaN") != -1) { Current = "Valeur incorrecte"; }; document.Calculator.Salaire.value = Current; } function FixCurrent2() { Current = document.Calculator.Bien.value; if (Current.indexOf("NaN") != -1) { Current = "Valeur incorrecte"; }; document.Calculator.Bien.value = Current; } //---------------------------------------------------------------> </script> </head> <body> <form name="Calculator"> <table width="398" id="calcul"> <tbody> <tr> <td width="6"> </td> <td width="163">Salaire brut annuel:</td> <td width="16"> </td> <td width="193">Prix du bien:</td> </tr> <tr> <td> </td> <td><input name="Salaire" type="text" class="contactform" size="20" maxlength="40" /> </td> <td> </td> <td><input class="contactform" maxlength="40" name="Bien" size="20" type="text" /> </td> </tr> <tr> <td> </td> <td><input onclick="Calculate2()" name="result" type="button" value=" Calcul prix du bien " /></td> <td> </td> <td><input onclick="Calculate()" name="result2" type="button" value=" Calcul du salaire " /></td> </tr> </tbody> </table> </form>
Partager