473,386 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Close Child Window via Parent using setTimeout

I would like to close a child window I opened from the parent using setTimout. I have tried these functions below, i succeed to open the window, but failed in closing it using the setTimeout function:

function 1
Expand|Select|Wrap|Line Numbers
  1. var sendWin;
  2. function sendWindow() {
  3. sendWin = window.open("http://www.google.fr");
  4. setTimeout("if (sendWin && !senWin.closed) sendWin.close()", 10000);
  5. }

function 2
Expand|Select|Wrap|Line Numbers
  1. function sendWindow() {
  2. var sendWin = window.open("http://www.google.fr");
  3. setTimeout(function() {
  4. if (sendWin && !senWin.closed) sendWin.close();
  5. }, 10000);
  6. }
Feb 25 '11 #1

✓ answered by Logic Ali

Expand|Select|Wrap|Line Numbers
  1.     var sendWin;
  2.     function sendWindow() {
  3.     sendWin = window.open("http://www.google.fr");
  4.     setTimeout("if (sendWin && !senWin.closed) sendWin.close()", 10000);
  5.     }
!!! Use the error console !!!!!(40 chars)

2 1329
Expand|Select|Wrap|Line Numbers
  1.     var sendWin;
  2.     function sendWindow() {
  3.     sendWin = window.open("http://www.google.fr");
  4.     setTimeout("if (sendWin && !senWin.closed) sendWin.close()", 10000);
  5.     }
!!! Use the error console !!!!!(40 chars)
Feb 25 '11 #2
(Responding to pm for clarification)

You wrote senWin instead of sendWin as highlighted in my reply. This would have generated an error message in the console, thus making the problem clear.

http://www.dreamincode.net/forums/to...error-console/
Mar 6 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Irvin Amoraal | last post by:
Process: I have a form which uploads a file from client to server written in PHP. When the user presses the submit button, I use the "onSubmit" event to execute javascript to open a child window...
3
by: John Smith | last post by:
I would like to close a child window I opened from the parent using setTimout. I have the function below, but it always returns the error "sendWindow is undefined". I would appreciate any...
1
by: dryer | last post by:
I'm trying to pass some values back and forth between a main page (on https) and a child window (on http) and keep getting 'Access Denied' messages. I know this is a security issue with the...
0
by: Prisy | last post by:
I am working on a web application. When i log out of the parent window i want all the child windows that are open to close. I picked one of the child windows and tried the code shown below to...
1
by: Samy | last post by:
Hi There, I have a child window opened from aspx page using window.open. On the child window, I have a button(New category) which opens a grandchild. I also have a cancel button on the child...
7
by: mg | last post by:
I need to first open WebForm2 from WebForm1 and then close WebForm1 without the end user having to press an OK button before the close can occur. For example, possibly ...
2
by: sanscrimson | last post by:
Hi! I just want to ask if it possible to call functions in parent window if the child window is created. Below is sample:...
2
by: javanet | last post by:
Hi all, 1) i opened a parent window. 2) then i opend a child window thruogh this parent window. Now i want to close child window before closing the parend window means my clients can not be...
2
by: gsuns82 | last post by:
hi all, I got to reload parent window from its child window,i used the folloeing code opener.location.reload(); self.close(); in child window. Parent window gets...
5
Frinavale
by: Frinavale | last post by:
This might be a very newbieish question but here it goes. I have a control that "pops out" when the user clicks a link. The control is a <div> element with some stuff in it that is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.