Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I open the pop up window after clicking on image button.Now i have to close that window after clicking on button .It does not close.Note i am using window.close() in javascript.
Posted
Comments
manognya kota 27-Jan-12 4:16am    
could you please explain how are you opening a popup and whether on clicking the same button you want the popup to close?

C#
function TimeoutCloseWindow2()
{
    window.setTimeout("window.close()", 1);
}
function DirectCloseWindow()
{
    window.close();
}
</script>
<p>
<a href="javascript:TimeoutCloseWindow2();">Workaround 1: Click here to try to close the window by using window.setTimeout("window.close()", 1)</a>
</p>
<p>
<a href="javascript:DirectCloseWindow();">Workaround 2: Click here to try to close the window by using window.close()</a>
</p>
</body>
</html>
 
Share this answer
 
v2
Comments
Anuja Pawar Indore 27-Jan-12 4:39am    
Added pre tag
C#
var mywin;//declare globally

//open window
mywin=window.open() ;

//close window
mywin.close();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900