Solved

check if Parent window is null javascript

Posted on 2011-03-02
4
648 Views
Last Modified: 2012-05-11
function checkParentWindow(thisItem)
        {
              ;
                .....
              if(parent!=null)
              {
                     parent.hello(thisValue);
                     self.close();
                }
        }
0
Comment
Question by:Rewaya
  • 2
4 Comments
 
LVL 16

Expert Comment

by:sjklein42
ID: 35017483
Is there a question?

What are you trying to accomplish?

0
 

Author Comment

by:Rewaya
ID: 35017494
yes it doesn't work
 if(parent!=null)  check statement  throw exception
             
0
 
LVL 16

Accepted Solution

by:
sjklein42 earned 500 total points
ID: 35017728
Try "thisItem.parent" instead.  Your implied use of "this" inside the function is not giving you the object that was passed as the input parameter "thisItem".  "this" inside the function probably means the function itself.

We might need to see the entire routine to give better advice.

It is not clear what you are trying to fetch with "thisValue".


function checkParentWindow(thisItem)
        {
              ;
                .....
              if(thisItem.parent!=null)
              {
                     thisItem.parent.hello(thisItem.thisValue);  //***** are you defining thisValue somewhere else? 
                     thisItem.close();
                }
        } 

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 35018482
Check this : http://www.w3schools.com/jsref/prop_win_opener.asp

Try :
if( window.opener != null )

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to read data from SQL server  to sharepoint 2013 ? 3 26
Insert Button on a table 16 38
Visual Studio npm 1 12
Fix Form size HTML 16 15
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question