Closing popup window after 3 seconds

前端 未结 8 1587
孤独总比滥情好
孤独总比滥情好 2020-12-03 18:02

I need to close the popup windows in the following after 3 seconds. How do I do it.


                  

        
8条回答
  •  长情又很酷
    2020-12-03 18:27

    Use a setTimeout, for example:

    var win = window.open("http://www.google.com", '1366002941508','width=500,height=200,left=375,top=330');
    
    setTimeout(function () { win.close();}, 3000);
    

    Sample fiddle: http://jsfiddle.net/N5rve/

提交回复
热议问题