Questo funziona cosi:
verifica la lunghezza del campo che deve essere di 12 caratteri compreso il punto, inoltre verifica la forma del numero, il primo numero non può essere uno zero e deve avere due decimali dopo il punto.
codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Pagina senza titolo</title>
<script type="text/javascript">
function convalida() {
var pattern = /^(([1-9]{1}\d{8})+\.)+(\d{2})+$/;
var campo = document.getElementById("campoInput");
if(campo.value.length<12){alert("Campo troppo corto");campo.focus();return false;}
else if (!campo.value.match(pattern)) {
alert("Il valore inserito non è corretto");
campo.focus();
return false;
} else {
alert("Il valore inserito è corretto");
}
}
</script>
</head>
<body>
<form action="form1" method="post" onsubmit="return convalida()"><table width="290" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="75">Numero</td>
<td width="144"><input name="campoInput" id="campoInput" type="text" maxlength="12" /></td>
<td width="59">Es: (123456789.00)</td>
</tr>
<tr>
<td><input name="Invia" type="submit" /></td>
</tr>
</table>
</form>
</body>
</html>
Spero vada bene ciao.