che sa trovare l'errore![]()
posto il mio codice completo:
codice:<%@LANGUAGE="VBSCRIPT"%> <% If (CStr(Request("MM_insert")) = "form1") Then response.Write("ciao") end if %> <html> <head> <script language="javascript" type="text/javascript"> function valida(theForm) { var strValue = document.form1.miadata.value; var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/ //check to see if in correct format if(!objRegExp.test(strValue)) return false; //doesn't match pattern, bad date else{ for (i=0; i<strValue.length; i++) { if (strValue.charAt(i)>'9') or (strValue.charAt(i)<'0') break; } var strSeparator=str.charAt(i); var arrayDate = strValue.split(strSeparator); //split date into month, day, year //create a lookup for months not equal to Feb. var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31,'06' : 30,'07' : 31, '08' : 31,'09' : 30,'10' : 31,'11' : 30,'12' : 31} var intDay = parseInt(arrayDate[1]); //check if month value and day value agree if(arrayLookup[arrayDate[0]] != null) { if(intDay <= arrayLookup[arrayDate[0]] && intDay != 0) return true; //found in lookup table, good date } //check for February (bugfix 20050322) var intMonth = parseInt(arrayDate[0]); if (intMonth == 2) { var intYear = parseInt(arrayDate[2]); if( ((intYear % 4 == 0 && intDay <= 29) || (intYear % 4 != 0 && intDay <=28)) && intDay !=0) return true; //Feb. had valid number of days } } return false; //any other values, bad date } </script> </head> <body> <form action="<%=MM_editAction%>" method="POST" name="miadata" id="miadata" onsubmit="return valida(this)"> <input name="miadata" type="text" id="miadata" > <input type="submit" name="Submit" value="Invia"> <input type="hidden" name="MM_insert" value="form1"> </form> </body> </html> :dhò:

Rispondi quotando
