PDA

View Full Version : Xin code pop-up mở ra tab mới 1 lần/1 ip/ 1 ngày



cuongmobi_88
10-05-2012, 09:50 PM
Như tiêu đề cái có code mở pop up ra tab mới chứ không phải ra của sổ mới 1 lần/1 ip/ 1 ngày và đã tét chắc chắn thành công thì cho mình xin. Mình tìm nhiều nơi nhưng chưa được. Mong anh em giúp đỡ và hướng dẫn chi tiết. thanks all

admin
11-05-2012, 11:34 AM
Tạo file popup.js với nội dung sau:


function Set_Cookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime(today.getTime());

if (expires) {
expires = expires * 1000 * 60 * 60 * 12;
}
var expires_date = new Date(today.getTime() + (expires));

document.cookie = name + "=" + escape(value) +
((expires) ? ";expires=" + expires_date.toGMTString() : "") +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
((secure) ? ";secure" : "");
}

function Get_Cookie(name) {

var start = document.cookie.indexOf(name + "=");
var len = start + name.length + 1;
if ((!start) &&
(name != document.cookie.substring(0, name.length))) {
return null;
}
if (start == -1) return null;
var end = document.cookie.indexOf(";", len);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(len, end));
}

function Delete_Cookie(name, path, domain) {
if (Get_Cookie(name)) document.cookie = name + "=" +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function popunder() {
if (Get_Cookie('vnsTraGopLT6')) {
return false;
} else {
Set_Cookie('vnsTraGopLT6', 'vnsTraGopLT PopUnder', '1', '/', '', '');
urls = ["http://itvnn.net"]
var url = urls[Math.floor(Math.random() * urls.length)]
params = 'width=' + screen.width;
params += ', height=' + screen.height;
params += ', top=0, left=0,scrollbars=yes'
params += ', fullscreen=yes';

pop = window.open(url, 'window', params).blur();
window.focus();
return false;
}
}

Sửa lại link itvnn.net thành link cần popup, sau đó upload file popup.js này vào thư mụcclientscript của forum

Mở template FORUMHOME chèn vào như sau:

Chèn vào thẻ <body> sự kiện onclick: <body onclick="popunder();">

Chèn trước thẻ </head> đoạn code này:
<script type="text/javascript" src="clientscript/popup.js"></script>

Click vào vị trí bất kì trên trang chính forum thì popup sẽ hiện ra.

cuongmobi_88
11-05-2012, 03:28 PM
Cám ơn admin đã hướng dẫn chi tiết, nhưng đây là code popup bật ra trang mới chứ không phải popup bật ra tab mới. Mong admin xem lại giúp em.