John Smith wrote:
function sendWindow()
{
var sendWin =
window.open('about:blank','sendwindow','width=100, height=100');
setTimeout('sendWin.close()',200);
}
Statements executed by setTimeout() run in the global execution
context, your variable sendWin is defined in your local function
context only (by using "var" inside the function).
Either you have to make sendWin global ...
var sendWin;
function sendWindow() {
sendWin = window.open(...);
setTimeout("if (sendWin && !senWin.closed) sendWin.close()", 200);
}
.... or you may use a closure, what means keeping sendWin
accessible in an nested function (JS1.2+) ...
function sendWindow() {
var sendWin = window.open(...);
setTimeout(function() {
if (sendWin && !senWin.closed) sendWin.close();
}, 200);
}
ciao, dhgm