Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all

i wrote a code that have two buttons one button to open power point file by openfiledialog, and the other button to close the opened window by the first button,
i need the code to close the opened window by button1
Posted

 
Share this answer
 
See the test code below;

XML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body>
<script type="text/javascript">

    var theWindow;

    function openGoogle() {
        theWindow = window.open("http://www.google.com/", "_blank")
    }

    function closeWindow(aWindow) {
        aWindow.close();
    }

</script>
<input type=button onclick="openGoogle()" value="open google"/>
<input type=button onclick="closeWindow(theWindow)" value="close the window" />
</body>
</html>
 
Share this answer
 
I am agree with Solution 1 provided by DaveAuld but you have not mentioned about WinForm or Web application.

If it is a winform application and power point file opensup into Office then you can close by checking running processes for power point.

If it is a Web Page then you can follow approach documented in first solution.

If getting problem understanding how to close process search on google with that match or let me know.

Regards
Rushi
 
Share this answer
 
SQL
Here I have a scenario where I am opening my window using navigate url in previous page In this scenario window.close(); will not work. Then how should we proceed. can any one help me on this.

Thanks in Advance...
 
Share this answer
 
Comments
[no name] 5-Sep-12 9:12am    
How, exactly, is this an answer to the original question asked almost a year ago?

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