Il codice finora funziona benissimo, ma solo per il campo e-mail.
Eccolo:
codice:<html> <head> <title>Studio Dentistico Polispecialistico - Dr. Pier Luigi Floris</title> <META HTTP-EQUIV="imagetoolbar" CONTENT="no"> <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_validateForm() { //v4.0 var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' deve essere valida.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' necessaria.\n'; } } if (errors) alert('Inserire email valida:\n'+errors); document.MM_returnValue = (errors == ''); } //--> </script> <style type="text/css"> <!-- --> </style> <link href="stylealtrepagtr2.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#33CCCC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td>[img]spacer.gif[/img]</td> <td>[img]spacer.gif[/img]</td> <td>[img]spacer.gif[/img]</td> <td>[img]spacer.gif[/img]</td> </tr> <tr> <td rowspan="5">[img]imges/layout3_r1_c1.gif[/img]</td> <td colspan="2" bgcolor="#33CCCC"><div align="center"> [img]titleflo.jpg[/img]</p> </div></td> <td>[img]spacer.gif[/img]</td> </tr> <tr> <td colspan="2" bgcolor="#33CCCC"><div align="center">Sassari, via Zanfarino 40 - tel. 079 274322</div></td> <td>[img]spacer.gif[/img]</td> </tr> <tr> <td rowspan="2">[img]imges/layout3_r3_c2.gif[/img]</td> <td>[img]imges/layout3_r3_c3.gif[/img]</td> <td>[img]spacer.gif[/img]</td> </tr> <tr> <td rowspan="2" valign="top" bgcolor="#CCFFCC"><div align="center"> <script src="xaramenu.js"></script> <script webstyle3 src="barra.js"></script> </div></td> <td>[img]spacer.gif[/img]</td> </tr> <tr> <td bgcolor="#CCFFCC"></td> <td>[img]spacer.gif[/img]</td> </tr> <tr> <td valign="top" bgcolor="#CCFFCC"> <div align="center"> <table width="98%" border="1" cellspacing="5" ID="tableSpot"> <tr> <td id="cellaSpot" valign="top" background="specch4.gif"> <p ID="paragSpot" align="center"></p> </td> </tr> </table> </div></td> <td colspan="2" valign="top" bgcolor="#CCFFCC"> <div align="justify"> <table width="90%" border="0" align="center"> <tr> <td></td> <td width="99%" valign="top"> <div align="justify"> <h1 align="center">Compila questo modulo per chiederci informazioni e/o suggerimenti.</h1> <form action="formcdosys.asp" method="post" name="form1" id="form1Info" onSubmit="MM_validateForm('e-mail','','RisEmail');return document.MM_returnValue"> <table width="80%" border="0" align="center" cellspacing="5"> <tr> <td nowrap>Nome</td> <td><input name="Nome" type="text" id="Nome" size="50" maxlength="50" /></td> </tr> <tr> <td nowrap>Cognome</td> <td><input name="Cognome" type="text" id="Cognome" size="50" maxlength="50" /></td> </tr> <tr> <td nowrap>Indirizzo</td> <td><input name="Indirizzo" type="text" id="Indirizzo" size="50" maxlength="300" /></td> </tr> <tr> <td nowrap>Telefono</td> <td><input name="Telefono" type="text" id="Telefono" size="50" maxlength="50" /></td> </tr> <tr> <td nowrap>Cellulare</td> <td><input name="Cellulare" type="text" id="Cellulare" size="50" maxlength="50"></td> </tr> <tr> <td nowrap>E-mail *</td> <td><input name="E-mail" type="text" id="E-mail" size="50" maxlength="50" /></td> </tr> <tr> <td nowrap>Cosa desideri?</td> <td><input name="Informazioni" type="checkbox" id="Informazioni" value="Si"> Informazioni</td> </tr> <tr> <td nowrap></td> <td><input name="Preventivo" type="checkbox" id="Preventivo" value="Si"> Suggerimenti</td> </tr> <tr> <td>Altre richieste o commenti</td> <td><textarea name="Commenti" cols="50" rows="5" id="Commenti"></textarea></td> </tr> <tr> <td colspan="2" nowrap><h2 align="center">N.B.: I campi contrassegnati con l'asterisco sono obbligatori</h2></td> </tr> <tr> <td nowrap></td> <td></td> </tr> <tr> <td nowrap></td> <td><input type="submit" name="Submit" value="Spedisci il modulo"> <input name="Cancel" type="reset" id="Cancel" value="Annulla"></td> </tr> </table> </form> </div> </td> <td></td> </tr> </table> </div> <p align="justify"> </p></td> <td valign="top">[img]spacer.gif[/img]</td> </tr> <tr> <td colspan="3" bgcolor="#CCFFCC"> <div align="center"></div></td> <td>[img]spacer.gif[/img]</td> </tr> </table> <map name="layout3_r1_c1Map"> <area shape="circle" coords="84,83,74" href="http://www.florisdental.it"> <area shape="circle" coords="71,101,1" href="#"> </map> </body> </html>

Rispondi quotando