hello there, this is the code var puShown = false; function doOpen(url) { if ( puShown == true ) { return true; } win = window.open(url, 'wmPu', 'toolbar,status,resizable,scrollbars,menubar,location,height=680,width=790'); if ( win ) { win.blur(); puShown = true; } return win; } function setCookie(name, value, time) { var expires = new Date(); expires.setTime( expires.getTime() + time ); document.cookie = name + '=' + value + '; expires=' + expires.toGMTString(); } function getCookie(name) { var cookies = document.cookie.toString().split('; '); var cookie, c_name, c_value; for (var n=0; n<cookies.length; n++) { cookie = cookies[n].split('='); c_name = cookie[0]; c_value = cookie[1]; if ( c_name == name ) { return c_value; } } return null; } function initPu() { if ( document.attachEvent ) { document.attachEvent( 'onclick', checkTarget ); } else if ( document.addEventListener ) { document.addEventListener( 'click', checkTarget, false ); } } function checkTarget(e) { if ( !getCookie('popundr') ) { var e = e || window.event; var win = doOpen('http://www.google.com'); setCookie('popundr', 1, 5*60*1000); } } initPu(); Code (markup): how i can make first time to open www.google.com and after 5 minutes (if the person stay 5 minutes on website) to open www.yahoo.com and after www.yahoo.com to stop for 24 hours (dont open anymore website for 24 hours) ... hope someone can help me with this ... thanks
I'm assuming you want the second window to open automatically? If so, after this line: var win = doOpen('http://www.google.com'); Code (markup): add: var win2 = window.setTimeout(doOpen, 300000, 'http://www.yahoo.com'); Code (markup):
var puShown = false; function doOpen(url) { if ( puShown == true ) { return true; } win = window.open(url, 'wmPu', 'toolbar,status,resizable,scrollbars,menubar,location,height=680,width=790'); if ( win ) { win.blur(); puShown = true; } return win; } function setCookie(name, value, time) { var expires = new Date(); expires.setTime( expires.getTime() + time ); document.cookie = name + '=' + value + '; expires=' + expires.toGMTString(); } function getCookie(name) { var cookies = document.cookie.toString().split('; '); var cookie, c_name, c_value; for (var n=0; n<cookies.length; n++) { cookie = cookies[n].split('='); c_name = cookie[0]; c_value = cookie[1]; if ( c_name == name ) { return c_value; } } return null; } function initPu() { if ( document.attachEvent ) { document.attachEvent( 'onclick', checkTarget ); } else if ( document.addEventListener ) { document.addEventListener( 'click', checkTarget, false ); } } function checkTarget(e) { if ( !getCookie('popundr') ) { var e = e || window.event; var win = doOpen('http://www.yahoo.com'); var win2 = window.setTimeout(doOpen, 300000, 'http://www.google.com'); setCookie('popundr', 1, 24*60*60*1000); } } initPu();"; Code (markup): i try like this but www.yahoo.com is open but after 5 minutes is not open www.google.com
Oh, looks like IE doesn't allow extra parameters to be passed to window.setTimeout(). Instead, change the line you just added to this: var win2 = window.setTimeout("doOpenDelay()", 300000); Code (markup): Then, add this function above the checkTarget() function: function doOpenDelay() { return doOpen('http://www.google.com'); } Code (markup):