sous étiquette de script J'ai besoin d'inclure les codes pour "valeur doit être non négative" quand un nombre négatif est entré. J'ai déjà inclus les codes pour "la valeur doit être un nombre".paramètres de validation
<script type="text/javascript">
function test_ifinteger(testcontrol, nameoffield) {
var x = 0;
var isok = true;
var teststring = testcontrol.value;
if (teststring.length == 0)
return true;
else {
while (x < teststring.length) {
if (teststring.charAt(x) < '0' || teststring.charAt(x) > '9')
isok = false;
x++;
} //end while
if (!isok) {
alert(nameoffield + " must be a number!");
testcontrol.focus();
} //end else if(ok)
return isok;
}//end else if (teststring.length==0)
} //end function
</script>