codice:<!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Language" content="it" /> <title>Esempio per il Forum di HTML.it</title> <script type="text/javascript"> function checkInput(oMyField, oKeyEvent) { var nChar = oKeyEvent.charCode, sChar = String.fromCharCode(nChar), rSeparator = /,/; return nChar === 0 || /\d/.test(sChar) || (rSeparator.test(sChar) && !rSeparator.test(oMyField.value)); } function checkValue(oMyField) { oMyField.value = oMyField.value.replace(/,$/, "").replace(/^,/, "0,"); } </script> </head> <body> <form name="form1"> <input type="text" name="importo1" onkeypress="return(checkInput(this, event));" onblur="checkValue(this);" onpaste="return(false);" /> <input type="text" name="importo2" onkeypress="return(checkInput(this, event));" onblur="checkValue(this);" onpaste="return(false);" /> <input type="text" name="importo3" onkeypress="return(checkInput(this, event));" onblur="checkValue(this);" onpaste="return(false);" /> <input type="text" name="importo4" onkeypress="return(checkInput(this, event));" onblur="checkValue(this);" onpaste="return(false);" /> <input type="text" name="importo5" onkeypress="return(checkInput(this, event));" onblur="checkValue(this);" onpaste="return(false);" /> <input type="text" name="importo6" onkeypress="return(checkInput(this, event));" onblur="checkValue(this);" onpaste="return(false);" /> <input type="text" name="nomeACaso" onkeypress="return(checkInput(this, event));" onblur="checkValue(this);" onpaste="return(false);" /></p> </form> </body> </html>![]()

