ok, allora, fammi indovinare... sei un utente clueless di javascript e hai fatto copia/incolla di qua e di là mettendo insieme un po' di codice e sperando che le cose andassero bene... va bene, dai, questa volta non hanno funzionato... vediamo di sistemare
VVoVe:
Nel tag head butta via tutti gli script che avevi, e metti solo questo
codice:
<SCRIPT>
<!--
/*
Required field(s) validation- By NavSurf
Visit NavSurf.com at http://navsurf.com
*/
// Prelevato e spiegato su http://www.web-link.it
function formCheck(formobj){
//1) Inserisci il nome che hai assegnato ai tuoi campi con name
var fieldRequired = Array("nome", "messaggio");
//2) Inserisci la descrizione del campo da riempire che appare nel messaggio a video
var fieldDescription = Array("Nome", "Messaggio");
//3) Inserisci il messaggio che deve precedere l'elenco dei campi non inseriti.
var alertMsg = "NON HAI INSERITO IL\n";
var l_Msg = alertMsg.length;
for (var i = 0; i < fieldRequired.length; i++){
var obj = formobj.elements[fieldRequired[i]];
if (obj){
switch(obj.type){
case "select-one":
if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "select-multiple":
if (obj.selectedIndex == -1){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "text":
case "textarea":
if (obj.value == "" || obj.value == null){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
default:
if (obj.value == "" || obj.value == null){
alertMsg += " - " + fieldDescription[i] + "\n";
}
}
}
}
var emai = formobj.elements["email"].value;
if(!emai.match(/[\w\.\-]+\@(\w+\.)+\w{2,4}/)) {
alert("dato E-mail non corretto");
formobj.elements["email"].focus();
return false;
}
if (alertMsg.length == l_Msg){
return true;
}else{
alert(alertMsg);
return false;
}
}
//-->
</SCRIPT>
E rimetti apposto il form:
Ossia in definitiva, la tua pagina dovrebbe essere così:
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Form per l'inserimento dei dati</title>
<link rel="stylesheet" href="stile.css" type="text/css">
<script langauge="javascript" type="text/javascript">
<!--
/*
Required field(s) validation- By NavSurf
Visit NavSurf.com at http://navsurf.com
*/
// Prelevato e spiegato su http://www.web-link.it
function formCheck(formobj){
//1) Inserisci il nome che hai assegnato ai tuoi campi con name
var fieldRequired = Array("nome", "messaggio");
//2) Inserisci la descrizione del campo da riempire che appare nel messaggio a video
var fieldDescription = Array("Nome", "Messaggio");
//3) Inserisci il messaggio che deve precedere l'elenco dei campi non inseriti.
var alertMsg = "NON HAI INSERITO IL\n";
var l_Msg = alertMsg.length;
for (var i = 0; i < fieldRequired.length; i++){
var obj = formobj.elements[fieldRequired[i]];
if (obj){
switch(obj.type){
case "select-one":
if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "select-multiple":
if (obj.selectedIndex == -1){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "text":
case "textarea":
if (obj.value == "" || obj.value == null){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
default:
if (obj.value == "" || obj.value == null){
alertMsg += " - " + fieldDescription[i] + "\n";
}
}
}
}
var emai = formobj.elements["email"].value;
if(!emai.match(/[\w\.\-]+\@(\w+\.)+\w{2,4}/)) {
alert("dato E-mail non corretto");
formobj.elements["email"].focus();
return false;
}
if (alertMsg.length == l_Msg){
return true;
}else{
alert(alertMsg);
return false;
}
}
//-->
</script>
</head>
<body bgcolor="#9999FF">
<html>
<head>
<title>Pannello di configurazione</title>
</head>
<body>
</body>
</html>
<div align="center"> </div>
<table width="400" border="1" align="center" cellpadding="4" bordercolor="#0000FF" bgcolor="#FFFFFF">
<tr bgcolor="#66FFCC">
<td height="19" colspan="2"><div align="center"><font color="#FF0000" size="5" face=" Arial,Verdana, Helvetica, sans-serif">Photoman's Guestbook</font></div></td>
</tr>
<tr>
<td width="200" bgcolor="#FFFFCC"> <center><div class="carattere">VAI ALL'HOMEPAGE</div></center></td>
<td width="200" height="19" bgcolor="#FFFFCC"> <center><div class="carattere">GUARDA I MESSAGGI</div></center></td>
</tr>
</table>
<table width="400" align="center" cellpadding="4" cellspacing="0" bordercolor="#000000" style="border:1px solid">
<tr>
<td bgcolor="#D20000" style="border-bottom:1px solid;"><div align="center"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">INSERISCI
IL TUO COMMENTO</font></div></td>
</tr>
<tr>
<td bgcolor="#99CCCC">
<form method="POST" onSubmit="return formCheck(this)"action="insert.php">
<table width="450" border="0">
<tr>
<td width="90"><font size="2">NOME: *</font></td>
<td width="310"><input name="nome" id="nome" size="30" maxlength="25" style="border:1px solid"></td>
</tr>
<tr>
<td width="100"><font size="2">EMAIL:
<font color="#008080"></font></td>
<td><input name="email" type="text" id="email" style="border:1px solid" size="30" maxlength="40"></td>
</tr>
<tr>
<td><font size="2">URL:
<font color="#008080"></font></td>
<td><input name="url" type="text" value="http://" id="url" style="border:1px solid" size="30" maxlength="50"></td>
</tr>
<tr>
<td valign="top"><font size="2">MESSAGGIO: *</font></td>
<td><textarea name="messaggio" cols="40" rows="10" id="commento" style="border:1px solid"></textarea></td>
</tr>
<tr>
<td valign="top"></td>
<td><input type="submit" name="Submit" value="Invia!"></a></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td bgcolor="#99CCCC"><font size="2">* Campi obbligatori</font></td>
</tr>
</table>
<div align="center">
<font size="2">Edited by Morris</font></p>
</div>
</body>
</html>