开发者

In Javascript (not JQuery), how do I make the window close after 2 seconds?

开发者 https://www.devze.com 2022-12-21 08:56 出处:网络
How do I create a function that will close the window after 2 seconds? 开发者_开发技巧<a href=\"\" onclick=\"close_it(); return false;\">

How do I create a function that will close the window after 2 seconds?

开发者_开发技巧<a href="" onclick="close_it(); return false;">
    Click to close the window after 2 seconds
</a>


You could use the setTimeout where an action is postponed for x number of milliseconds.

setTimeout(function(){
  window.close();
}, 2000);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号