Hi, Dave.

 

Actually parent and child windows in document object model have different _javascript_ object window. That’s why window.close() – always will close current window. From child to parent window object you always will be able to access like that:

 var parentWindowObject = window.opener;

 

Of course may be we are talking about different browsers. This is all works for IE6.

 

Thanks,

Yura.


From: Dave [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 28, 2006 11:29 AM
To: MyFaces Discussion
Subject: RE: How to close popup using a button

 

Inside a popup,

 

<h:commandButton value="Close" return false;"/>

 

This will close the parent window, not only the popup. Is there a way to close popup only?

 

Thanks!

 

[EMAIL PROTECTED] wrote:

Or you can use server-side handler of this button to close your popup, something like this:

 

JSF page:

 

<!-- js code will be rendered here -->

<h:outputText escape="false" value="<script type=\"text/_javascript_\" language=\"_javascript_\"#{bean.jsCode}</script>"

<h:commandButton action="">

 

Java code:

 

public void doSubmit() {

  // do something

  ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­..

  // close popup

  setJsCode(¡°window.close();¡±);

}

 

Best regards,

Yura.

 

-----Original Message-----

From: Dennis Byrne [mailto:[EMAIL PROTECTED]

Sent: Tuesday, March 28, 2006 10:38 AM

To: MyFaces Discussion

Subject: Re: How to close popup using a button

 

Use window.close();

 

;)

 

Dennis Byrne

 

>-----Original Message-----

>From: Dave [mailto:[EMAIL PROTECTED]

>Sent: Tuesday, March 28, 2006 02:28 AM

>Subject: How to close popup using a button

> 

>I like to add a  <commandbutton> (Close)&nb sp; in a popup, how to close the popup when user click the button? Thanks!

> 

>          

>---------------------------------

>New Yahoo! Messenger with Voice. Call regular phones from your PC for low, low rates.

 

 


New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

Reply via email to