I am trying to automatically close a window after a short delay and this
posting seemed to be relevant
I am opening a window using an onclick which calls Javascript
<a href="images/family-pictures.jpg"
onclick="OpenWindow('images/family-pictures.jpg','Image1');return
false;">
<img src="images/thumbnails/family-pictures.jpg" alt=""></a>
function OpenWindow(ImgName,ImgNo)
{
spawnJimcoPopup
(ImgName,ImgNo,
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes',
'400','640','0','0','pixel');
return false;
myTimer=setTimeout("window." + ImgName + ".close()",5000);
}
function spawnJimcoPopup(url, name, options, h, w, x, y, scaleType)
{
var windowOptions;
if (scaleType == 'percent')
{ w = (w * screen.availWidth) / 100;
h = (h * screen.availHeight) / 100; }
if (x == 'center')
{ x = (screen.availWidth - w) / 2;
y = (screen.availHeight - h) / 2; }
windowOptions = options + ',width=' + w + ',height=' + h + ',left=' + x +
',top=' + y;
newWindow = window.open(url, name, windowOptions);
newWindow.focus();
}
The function spawnJimcoPopup works perfectly (of course) but the timeout
does not. I want to display the new window for 5 seconds and then have it
close automatically, but nothing happens.
I am sure there is something wrong with the call to the setTimeout function
but I can't see what
All help appreciated
--
Cheers,
Trevor L.
I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html