Cosi dovrebbe andar bene aggiunge ,00 alla fine del numero se quello che volevicodice:<html> <head> <script type="text/javascript"> function ControlloNumero(obj){ valore = document.getElementById('importo').value.replace(/[^\d]/g,'').replace(/^0+/g,''); if(valore.length>0){ nuovovalore=valore.substr(valore.length)+',00';} else{nuovovalore=''; } while(valore.length>3){ nuovovalore='.'+valore.substr(valore.length-3)+nuovovalore; valore = valore.substr(0,valore.length-3); } document.getElementById('importoFormattato').value=valore+nuovovalore; } </script> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <input id="importo" name="importo" onblur="ControlloNumero()" type="text" /> <input id="importoFormattato" name="importoFormattato" type="text" /> </body> </html>![]()