codice:
function prenotazione(posto){
var w = 400;
var h = 250;
var l = Math.floor((screen.width-w)/2);
var t = Math.floor((screen.height-h)/2);
if(isFree(posto) == false)
window.alert("il posto non e' disponibile");
else{
prenWindow = window.open("prenotazione","","width=" + w + ", height=" + h + " ,top=" + t + ", left=" + l );
prenWindow.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">');
prenWindow.document.writeln('<html><head><title>Prenotazione</title>'+
'<?php include("functions.php");?>'+
'<script type="text/javascript" src="teatro.js"></script>' +
'<link rel="stylesheet" type="text/css" href="stile2.css" media="screen">'+
'</head>');
prenWindow.document.writeln('<body><p id="main">');
prenWindow.document.writeln('Prenotazione');
prenWindow.document.writeln('<form action="abc.php" method="GET" name="prenota">'+
'prenotazione posto: <input type="text" value="'+posto+'" readonly="readonly" name="posto" size="2">
'+
'nome: <input type="text" name="nome">
'+
'cognome: <input type="text" name="cognome">
'+
'email: <input type="text" name="mail">
'+
'<input type="reset" value="resetta">'+
'<input type="submit" value="prenota">'+
'<button type="button" onClick="window.close();">chiudi</button>'+
'<button type="button" onClick="ttt();"> TTT </button>'+
'</form>');
prenWindow.document.writeln("</p></body></html>");
prenWindow.document.close();
}
}
Questa è la funzione che mi apre il popup con il form da compilare, ho aggiunto un button di prova TTT che una volta cliccato lancia una funzione ttt().
Se volessi che la funzione ttt() mi chiuda la popup da dove viene lanciata e mi riporti il focus sulla finestra principale come dovrei fare?