Cosi funziona:
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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento senza titolo</title>
<script language="javascript">
function controlla(){
if(form_chat.nickname.value==""){
alert("Devi inserire un NickName");
form_chat.nickname.focus();
return false;
}
var popup = window.open('chat.php','popup','toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=740,height=300,left=0,top=0');
form_chat.submit();
return false;
}
</script>
</head>
<body>
<form action="chat.php" method="post" name="form_chat" target="popup" onSubmit="return controlla()">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="23%">Nickname</td>
<td width="77%"><input name="nickname" type="text" id="nickname" /></td>
</tr>
<tr>
<td>Conferma</td>
<td><input type="submit" name="Submit" value="Accedi" /></td>
</tr>
</table>
</form>
</body>
</html>