Popup ngày nay có rất nhiều loại, tôi đã từng viết 1 bài viết giới thiệu Code Popup nhảy ở góc màn hình . Hôm nay tôi xin giới thiệu thêm 1 loại popup mới đó là code popup nhảy ra tab mới. Với popup này bạn nó tác dụng trực quan hơn và giúp việc quảng cáo thương hiệu tốt hơn.
Code js bắn popup dạng tab:
function Set_Cookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime(today.getTime());
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=Mon, 11-November-1989 00:00:01 GMT";
}
function popunder() {
if (Get_Cookie('cucre') == null) {
Set_Cookie('cucre', 'cucre Popunder', '1', '/', '', '');
var url = "http://agola.vn/dien-dan-hoc-tap/7-Sinh-Vien.agola.vn";
pop = window.open(url, 'windowcucre');
pop.blur();
window.focus();
}
}
function addEvent(obj, eventName, func) {
if (obj.attachEvent) {
obj.attachEvent("on" + eventName, func);
}
else if (obj.addEventListener) {
obj.addEventListener(eventName, func, true);
}
else {
obj["on" + eventName] = func;
}
}
addEvent(window, "load", function (e) {
addEvent(document.body, "click", function (e) {
popunder();
});
});
Sau đó bạn chỉ cần gọi file gì js vào trong index của template. Như vậy bạn đã thành công rồi.
Nguồn http://forum.congnghethongtin.org/ja...html#post56254
Bookmarks