We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


JavaScript PopUp window.

RamyBouchra asked
Medium Priority
Last Modified: 2008-03-04
Dear Experts.

i am using ASp.Net2.0 C#
i have window and i want to open a new small window, when the user close this small window i want the parent window that called this small one to know, without postingBack the parent window, througth JavaScript.

thank you.
Watch Question

What exactly are you trying to achieve?

call from client side script , ie if you want to open popup frm a button click

<input type="button" id= "test" onclick="open();">

function open()

window.open       (szURL,"mywindow","width=700,height=600,status=0,toolbar=0,scrollbars=0");

Here szURL = your url of the popup window. width, height  ,status... all are properties of the popup window.

and in popup window you can capture the onunload event of the body..

on onunload update a variable or hidden field in the parent window like

window.opener.GlobalVariable__Name = 1;


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Most Valuable Expert 2012
Top Expert 2008

Sounds like window.open to me.


 hope the code below will be helpful to u...

Include this code on ur parent window

<input type=button
   value="Open Window">

On child window incude the code below....

<title>(Type a title for your page here)</title>

<SCRIPT language=JavaScript>
function win(){


<input type=button onClick="win();" value="Close this window">


Are you trying to refresh parent window without postback when popup is closed ? then AJAX is the way to go.


This can be done by adding a control (hidden html control, textbox control, lable control etc) on your parent page and on the Child window's function win(), assign value to that control as:

function win(){
window.opener.getElementById('txtname').value = "1";

This will assign a value '1' to the parent's page control without refreshing the it.



Forgot to add .document. The function win() will be now:

function win(){
window.opener.document.getElementById('txtCtrlname').value = "1";

here 'txtCtrlname' is the name of the control  (I have used textbox) you have added.

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.