简体   繁体   中英

Trying to close window after alert

Ok so I have a page that will post info to the database then it returns to a different page. The only thing is now they want the page to auto close once the alert comes up telling them the database stuff has been saved. I have it on a php page under the conditional if statement and then running javascript from there. The only thing that isnt working it the close. I have tried window.close and self.close and just close() but nothing seems to be working any ideas. Also trying this in Chrome.

if( $_POST['finished'] == 'Send' )  
{

(this is just DB stuff here)

echo "<script type='text/javascript'>ConfirmStatus = confirm('Thank you for entering the information.')

if (ConfirmStatus == true) {

self.close();
}</script>";    
}
echo "<script type='text/javascript'>
    if (confirm('Thank you for entering the information.')){
    window.close();
    }</script>";

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