Ciao a tutti, ho bisogno di un aiuto importante per far funzionare questo Form du Google Chrome
"NON FUNZIONA IL MESSAGGIO ALERT" - Mi aiutate per favore ?? GRAZIE...
Questo è il file "form.htm"
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Mobile Phone</title>
<script type="text/javascript" language="javascript" src="validation.js"></script>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<form method="POST" name="modulo" action="invia.php" onSubmit="return Controlla(this);">
<div align="left">
<table border="0" width="555" cellspacing="0" id="table288" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF">
<p align="left"><i><b>
<font face="Arial" color="#4B4B4B">
Verifica disponibilità</font></b></i></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
</td>
</tr>
</table>
</div>
<div align="left">
<table border="0" width="661" cellspacing="0" id="table289" cellpadding="0">
<tr>
<td width="8" bgcolor="#FFFFFF"> </td>
<td width="206" bgcolor="#FFFFFF">
<font face="Arial" size="2" color="#4B4B4B">
Cognome:</font><font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#FF0000">*</font></td>
<td width="17" bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF" width="208">
<font face="Arial" size="2" color="#4B4B4B">
Nome:</font><font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#FF0000">*</font></td>
<td width="17" bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF" width="205">
<font face="Arial" size="2" color="#4B4B4B">
E-mail:</font><font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#FF0000">*</font></td>
</tr>
<tr>
<td width="8" bgcolor="#FFFFFF"> </td>
<td width="206" bgcolor="#FFFFFF">
<font size="4" face="Palatino Linotype">
<input type="text" name="cognome" size="25" style="border:1px solid #D1D1D1; float: left; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></font></td>
<td width="17" bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF" width="208">
<font size="4" face="Palatino Linotype">
<input name="nome" size="25" style="border:1px solid #D1D1D1; float: left; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></font></td>
<td width="17" bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF" width="205">
<font size="4" face="Palatino Linotype">
<input type="text" name="email" size="25" style="border:1px solid #D1D1D1; float: left; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></font></td>
</tr>
<tr>
<td width="8" bgcolor="#FFFFFF"> </td>
<td width="206" bgcolor="#FFFFFF">
<font face="Arial" size="2" color="#4B4B4B">
Telefono/Cellulare:</font><font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#FF0000">*</font></td>
<td width="17" bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF" width="208">
<font face="Arial" size="2" color="#4B4B4B">
Città:</font><font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#FF0000">*</font></td>
<td width="17" bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF" width="205">
</td>
</tr>
<tr>
<td width="8" bgcolor="#FFFFFF"> </td>
<td width="206" bgcolor="#FFFFFF">
<font size="4" face="Palatino Linotype">
<input type="text" name="telefono" size="25" style="border:1px solid #D1D1D1; float: left; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></font></td>
<td width="17" bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF" width="208">
<font size="4" face="Palatino Linotype">
<input type="text" name="citta" size="30" style="border:1px solid #D1D1D1; float: left; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></font></td>
<td width="17" bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF" width="205">
</td>
</tr>
</table>
<div align="left">
<div align="left">
<table border="0" width="660" cellspacing="0" cellpadding="0" id="table380">
<tr>
<td>
<table cellSpacing="0" cellPadding="0" align="center" border="0" id="table677" width="340">
<tr>
<td style="FONT-SIZE: 9pt; COLOR: #003e84; FONT-FAMILY: Verdana" vAlign="top">
</td>
<td style="FONT-SIZE: 9pt; COLOR: #003e84; FONT-FAMILY: Verdana" vAlign="top" width="160">
<p><font size="2" color="#4B4B4B" face="Arial">Modalità di pagamento:</font><b><font color="#FF0000" size="2">*</font></b></td>
<td style="FONT-SIZE: 9pt; COLOR: #003e84; FONT-FAMILY: Verdana" width="159">
<font size="2" color="#000000"><br>
</font>
<font face="Verdana">
<input type="radio" value="Bonifico Bancario" name="pagamento" checked></font><font size="2" color="#000000"><font face="Arial">Bonifico
Bancario</font><br>
</font>
<font face="Verdana">
<input type="radio" value="Contanti" name="pagamento"></font><font size="2" color="#000000"><font face="Arial">Contanti</font><font face="Palatino Linotype"><br>
</font></font></td>
</tr>
</table>
<div align="center">
<table border="0" width="400" cellpadding="0" id="table678">
<tr>
<td width="20">
<p align="left">
<label for="accetto">
<input id="accetto" type="checkbox" value="accetto" name="C6" checked /></label>
</td>
<td>
<a href="file:///E:/Backup%20ELIO%2005.06.2012/Materiale%20di%20Elio/sito%20ELMAR/Sito%20v.23%20con%20nuova%20Area%20protetta/protect/protect-APREAMARE/x" class="linkelmar">
<font face="Arial" color="#4B4B4B" size="1">
<span style="text-decoration: none">Autorizzo trattamento Dati Personali</span></font><b><span style="text-decoration: none"><font face="Arial" size="1" color="#4B4B4B">
»</font></span></b></a></td>
<td width="146">
<p align="center">
<b>
<font size="2" face="Arial" color="#4B4B4B">(</font><font color="#FF0000" size="2" face="Verdana">*</font><font size="2" face="Arial" color="#4B4B4B"> )
</font><i><span lang="it">
<font size="1" face="Arial" color="#4B4B4B">Campi obbligatori</font></span></i></b></td>
<td width="18">
</td>
</tr>
</table>
<div align="center">
<table border="0" width="425" id="table679">
<tr>
<td width="76"> </td>
<td width="320">
</td>
<td width="15">
</td>
</tr>
<tr>
<td width="76"><font face="Arial" size="2" color="#4B4B4B">Particolari servizi o necessità:</font></td>
<td width="320">
<textarea name="richieste" rows="5" cols="50" style="border:1px solid #C0C0C0; padding-left:3px; padding-right:3px; color:#43C5C3; font-family:Arial"></textarea></td>
<td width="15">
</td>
</tr>
</table>
</div></div>
</td>
<td width="226">
<div align="left">
<table border="0" width="186" cellspacing="4">
<tr>
<td width="176">
</td>
</tr>
<tr>
<td width="176">
</td>
</tr>
<tr>
<td width="176">
</td>
</tr>
<tr>
<td width="176">
</td>
</tr>
<tr>
<td width="176">
</td>
</tr>
<tr>
<td width="176">
<input type="button" value="Verifica disponibilità" onClick="Controlla()" style="width: 170; height: 34; color: #FFFFFF; font-family: Verdana; font-size: 11; font-weight: bold; border-style: solid; border-width: 0; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; background-image: url('pulsante-invia.jpg'); float:left"></td>
</tr>
</table>
</div>
</td>
</tr>
</form>
</table>
</div>
</div>
</div>
</body>
</html>
Questo è il file "validation.js"
function Controlla(){
var cognome = document.modulo.cognome.value;
var nome = document.modulo.nome.value;
var email = document.modulo.email.value;
var telefono = document.modulo.telefono.value;
var citta = document.modulo.citta.value;
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
var alertMsg = "Il form contiene uno o più errori:\n";
Errore="";
if(document.getElementById('cognome').value==""){Errore=alertMsg += " -> Il campo Cognome è richiesto\n";
document.modulo.cognome.value = '';
}
if(document.getElementById('nome').value==""){Errore=alertMsg += " -> Il campo Nome è richiesto\n";
document.modulo.nome.value = '';
}
if(!email_reg_exp.test(email)){Errore=alertMsg += " -> Il campo E-mail deve contenere un indirizzo email valido\n";
document.modulo.email.value = '';
}
if(document.getElementById('telefono').value==""){Errore=alertMsg += " -> Il campo Telefono è richiesto\n";
document.modulo.telefono.value = '';
}
if(document.getElementById('citta').value==""){Errore=alertMsg += " -> Il campo Città è richiesto\n";
document.modulo.citta.value = '';
}
if (document.forms['modulo'].accetto.checked==false){Errore=alertMsg += " -> Il checkbox Autorizzo trattamento dati deve essere selezionato\n";
}
if(Errore==""){
document.modulo.action = 'invia.php';
document.modulo.submit();
}else{
alert(Errore);
}
}