Bjr, j'ai un formulaire où je dois saisir seulement les nombre entier ou décimaux, j'ai un script qui m'a l'air pas mal
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 String.prototype.isFloat= function() { var n=(arguments.length>0) ? arguments[0] : "0"; var reg=new RegExp("^[0-9]+[\.|,]?[0-9]{0,"+n+"}$", "g"); return(reg.test(this)); } function test(champ) { return(champ.value.length >= 0 && champ.value.isFloat(2)); }
or j'appelle ce script avec
mais ça ne fonctionne pas et je n'arrive pas à comprendre pk...Code:echo "<td><input type=\"text\" name=\"CA\" onkeypress=\"this.value=test(this.value);\" value=\"".$Row['Base']."\" style=\"width:80px;\" /></td>";