Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 25th, 2004, 05:21 AM
Authorized User
 
Join Date: Jul 2004
Location: New Delhi, Delhi, India.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sherbir
Default Make child close automatically after 3 seconds

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("<center>");
    x.document.write("<table bgcolor='steelblue'>");
    x.document.write("<tr><td align=center><b>Saving the File...</b></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("This may take a few minutes.<br>Please Wait...");
    x.document.write("</td>");
    x.document.write("</tr>");
    x.document.write("<tr><td>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;</td></tr>");
    x.document.write("</table>");
    x.document.write("</center>");
    setTimeout('self.close()',3000);
}

It's not working. The child window stays as is.

How do I make the child close automatically after 3 seconds ?

Any ideas ??

Regards,
Sherbir
__________________
Regards,
Sherbir
Reply With Quote
  #2 (permalink)  
Old August 25th, 2004, 02:32 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

You're setTimeout line is calling to close the current window when you want to close the child window.

So, just replace 'self' with 'x'.

HTH,

Snib

<><
Reply With Quote
  #3 (permalink)  
Old August 25th, 2004, 11:24 PM
Authorized User
 
Join Date: Jul 2004
Location: New Delhi, Delhi, India.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sherbir
Default

Quote:
quote:Originally posted by Snib
 You're setTimeout line is calling to close the current window when you want to close the child window.

So, just replace 'self' with 'x'.

HTH,

Snib

<><
Thanx alot buddy !!
It worked ! :D

Regards,
Sherbir
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tomcat window close automatically Edward King Apache Tomcat 1 July 5th, 2011 05:59 AM
Close Child window automatically on closing parent vikas67k C# 1 August 26th, 2008 02:00 AM
Tip: How to open/close CDROM automatically crmpicco Javascript How-To 3 April 9th, 2008 05:30 AM
How to close window automatically? Edward King Javascript How-To 1 June 17th, 2004 11:56 AM
Close in the load event on child form gvozden VB.NET 0 October 22nd, 2003 10:48 AM



All times are GMT -4. The time now is 11:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.