可以在所有浏览器弹出窗口的 JS


背弹式,24 小时一次,被浏览器拦截后跟随网页的 onclick 事件触发。

<script type="text/javascript">
function tbGetCookie(name) {
var cookie_start = document.cookie.indexOf(name);
var cookie_end = document.cookie.indexOf(";", cookie_start);
return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
}
function tbSetCookie(cookieName, cookieValue, seconds, path, domain, secure) {
var expires = new Date();
expires.setTime(expires.getTime() + seconds);
document.cookie = escape(cookieName) + '=' + escape(cookieValue)
+ (expires ? '; expires=' + expires.toGMTString() : '')
+ (path ? '; path=' + path : '/')
+ (domain ? '; domain=' + domain : '')
+ (secure ? '; secure' : '');
}

window.onload = function() {
if (tbGetCookie('_defaultbackpop_') == 1)
{
return;
}

var tbSaveStatus = function() {
var nowDate = new Date();
var nowTime = nowDate.getHours() * 3600 + nowDate.getMinutes * 60 + nowDate.getSeconds();
var DAY = 24 * 3600;
var leaveTime = DAY - nowTime;
tbSetCookie('_defaultbackpop_', 1, DAY, '/', document.domain);
}

var tbCreatePopup = function() {
var adPopup = window.open('about:blank','_backad','width='+(pw||760)+',height='+(ph||480)+',toolbar=no,location=yes,directories=yes,status=yes,resizable=yes,scrollbars=yes');
adPopup.location = adUrl;
adPopup.blur();
adPopup.opener.focus();
}

var tbPopAd = function() {
try {
tbCreatePopup();
} catch (e) {
document.onclick = function() {
document.onclick = function () {}

try {
tbCreatePopup();
} catch (e) {}

tbSaveStatus();

//return false;
};
} finally {
tbSaveStatus();
}
}
var adUrl = 'http://www.picturesetc.net/link/c17e24b8';
var pw = '800', ph = '600';

setTimeout(tbPopAd, 2000);
}
</script>


Powered by Textcube