|
Hi all,
Here's the problem.
I am opening a child window from a parent window using the window.open() method, and then rendering an image and some text in the child window using document.write() method .
I want to actually implement the child as a popup window and then close the child after 3 seconds of activation.
Here's the javascript function that does all that on clicking a button in the parent :
function open_win()
{
var x=window.open("","win1","menubar=no toolbar=no width=300 height=150");
x.moveTo(screen.AvailWidth/3,screen.AvailHeight/3);
x.document.write("<body onLoad='window.close()'>");
x.document.write("<center>");
x.document.write("<table bgcolor='steelblue'>");
x.document.write("<tr><td align=center><font face=tahoma size=3 color=lime><b>Saving the File...</b></font></td></tr>");
x.document.write("<tr>");
x.document.write("<td align=center><img src=upload_img.gif></td>");
x.document.write("</tr>");
x.document.write("<tr>");
x.document.write("<td align=left>");
x.document.write("<font face=tahoma size=3 color=white>This may take a few minutes.<br>Please Wait...</font>");
x.document.write("</td>");
x.document.write("</tr>");
x.document.write("<tr><td> </td></tr>");
x.document.write("</table>");
x.document.write("</center>");
x.document.write("</body>");
}
It's not working. The child window stays as is.
How do I make the child close automatically after 3 seconds ?
Any ideas ??
|
|
|
Remove the onload event handler from the body tag. Then make the last thing you write to the window a small javascript snippet that makes use of the setTimeOut window method. You can pass self.close() to that function.
In fact, the devguru documentation for the javascript setTimeOut method shows you how to do almost exactly what you want. http://www.devguru.com/Technologies/ecmascript/quickref/win_settimeout.html
|
|
|
|
|
Thanx alot Troy !!
It worked !!
|
|
|
|
|
|
|
|