Jump to content
Sign in to follow this  
washingtonirvine

Time sensitive popup html

Recommended Posts

Hi im using this little bit of code i found to write a short sweet popup script{day = new Date();id = day.getTime();eval("page" + id + " = window.open(URL1, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statu… = 533,top = 234');");i copied it so i never woried to much about what it all means its quite obvious.However i was wondering about the time and date bit at the start. can i put in commands to make them open randomly, at a time of day, a specific time into veiwing a page and if so what do i tell it. I was hoping for any insight and tips you could give me relating to this area of coding. i dont really need to make a popup open at a special time but it got me curious.Thanks Washington

Share this post


Link to post
Share on other sites

I'm not sure about the actual implementation using eval per se, but you can instantiate the date object to take a date you make. So for instance, if you want it to open after the user has been on the page for 5 minutes, you could take the time (from getTime) and add 300000 (milliseonds) to it. Or you can create a random function to pick a number 1 -10 (for example) and set that as the number of minutes, seconds, etc in which to call a setTimeout function to run. Defining the exact requirements will help narrow down the possible solutions.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...