washingtonirvine Posted March 17, 2011 Share Posted March 17, 2011 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 Link to comment Share on other sites More sharing options...
thescientist Posted March 17, 2011 Share Posted March 17, 2011 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.