0

I have this code which is a pop up message. On this specific code how could I close the pop up after 5 seconds?

function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=420,left = 580,top = 335');");
}
j08691
  • 204,283
  • 31
  • 260
  • 272
user2607179
  • 95
  • 1
  • 2
  • 8
  • Use the link to get your answer - it is a different question but it is the answer you are looking for. – PW Kad Aug 13 '13 at 16:55
  • Refer this: http://stackoverflow.com/questions/8353126/javascript-close-popup-windows-after-certain-time – Kitty1911 Aug 13 '13 at 16:56
  • 3
    Please do not use `eval`! Instead use an object. `var pages = {};` Then: `pages[id] = window.open();`. – gen_Eric Aug 13 '13 at 16:58
  • 2
    This is not related to your problem, but -- I highly recommend you learn about, and beginning using, local variables (declared with the `var` keyword). – ruakh Aug 13 '13 at 16:59
  • my problem is that all this code works normally on the site so please if I have to do any changes show me on this code. Or what I have to add. – user2607179 Aug 13 '13 at 17:02

0 Answers0