faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

how can i close the popup and open dialog box on button click of the popup

Apr 8th, 2008 19:16
ha mo, Dave Clark, shradha selarka,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shradha,
     It is not possible for JavaScript to close the browser's Open 
dialog without requiring the user to click the buttons.  The reason 
for this has to do with security.  Sorry.  As for closing a JavaScript 
popup window via a button click in the popup window itself, the 
following will do that:
<button type="button"
 onclick="top.close(); return true;">Close</a>
     To close a JavaScript popup widow via a button click in the 
parent window, the following will do that:
<button type="button"
 onclick="if (ptr1 && !ptr1.closed) ptr1.close(); return 
true;">Close</a>
This presumes that the parent window saved the pointer to the popup 
window in a global variable -- such as the following:
var ptr1 = null;
function OpenPopup()
{
    ptr1 = window.open(...);
    return true;
}
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com