简体   繁体   中英

How do I close a window after the user clicks on the close button in file upload?

We have a requirement to close the popup window itself when the user clicks on the cancel button in the file upload.

  1. main.html
  2. popup.html

popup.html contains <input type="file" .

Now we have a requirement that when a user clicks on the cancel button in the file upload window popup.html should also be closed.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<html> 
<head> 
    <script language="javascript"> 
    function openModalDlg() { 
        window.open( "test.html", "", 'width=400,height=100'); 
    } 
    </script> 
</head> 
<body> 
    <p> 
        Click 
        <a href="#" onclick="openModalDlg();">here</a> 
        to open modal dialog 
    </p> 
</body> 
</html> 

您可以使用window.close方法:

<input type="button" value="Close" onclick="window.close();" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM