Code Tạo Quảng Cáo Popup mở nhiều cửa sổ cho Blogspot

Như các bạn đã thấy khi vào các trang phim thường đầu tiên bạn sẽ bị nhảy một loạt các cửa sổ tự động bật ra về một trang web khác. Và chỉ cần load lại một lần nữa thì pop lại bật ra khiến người xem khó chịu và mất dần đi lượt truy cập của web bạn. Sau đây mình sẽ giới thiệu với các bạn cách tạo quảng cáo một lần duy nhất khi truy cập website đối với blogspot hay bất cứ trang web nào:

popup new Tab, new Windows

Thực hiện

Bước 1: Vào blogger → Mẫu → Chỉnh sửa HTML
Bước 2: Mở rộng mẫu tiện ích
Bước 3: Bạn tìm đến thẻ <body> và thay nó thành 1 trong 2 đoạn Script sau

A. Javascript xuất hiện nhiều tab mỗi khi click chuột

<body onclick='vtlai_popup(); open_popup() '>

<script type='text/javascript'>
/* <![CDATA[ */
function open_popup() {
window.open("http://www.thienhieu.com/")
window.open("http://www.thienhieu.com/")
window.open("http://www.thienhieu.com/")
}
/* ]]> */
</script>

- Trong đó thay các trang màu đỏ thành các trang bạn muốn.
Để thêm một cửa sổ Popup bạn thêm đoạn code sau:



window.open("http://www.thienhieu.com/")

B. Javascript xuất hiện popup khi click chuột lần đầu tiên.

Cái nàu gần giống bài: Tạo popup chỉ xuất hiện một lần duy nhất cho blog nhưng cách làm và code khác nhau hoàn toàn.

<body onclick='vtlai_popup(); open_popup() '>                                                                                                                                                                                                                       <script language="javascript">
/* <![CDATA[ */
var sinhvienit=0;
function SVIT_ADS_GetCookie(Name){
var re=new RegExp(Name+"=[^;]+", "i");
if (document.cookie.match(re))
 return decodeURIComponent(document.cookie.match(re)[0].split("=")[1]);
return ""
}                                                                                                                                                                                                                                                                                       function SVIT_ADS_SetCookie(name, value, days){
if (typeof days!="undefined"){
 var expireDate = new Date()
 var expstring=expireDate.setDate(expireDate.getDate()+days)
 document.cookie = name+"="+decodeURIComponent(value)+"; expires="+expireDate.toGMTString()
}
else document.cookie = name+"="+decodeURIComponent(value);
}                                                                                                                                                                                                                                                                                       function vtlai_popup()
{
 var cookie_popup_ads = SVIT_ADS_GetCookie('sinhvienit_popup_ads');
 if (cookie_popup_ads=='') {  
    if(sinhvienit==0)
  { 
   sinhvienit=1;                                                                                                                                var Time_expires = 24 * 3600 * 1000;
   SVIT_ADS_SetCookie('sinhvienit_popup_ads','true',Time_expires);
   var urllist = ['http://www.thienhieu.com/','http://www.thienhieu.com/','http://www.thienhieu.com/'];                                                                                                                                      var url = urllist[Math.floor(Math.random() * urllist.length)];
   var params = 'width=' + '300';
   params += ', height=' + '300';                                                                                                 params += ', top=0,left=0,scrollbars=yes,status=1,toolbar=1,menubar=1,resizable=1,location=1,directories=1';
   var pop_ads_open = window.open(url, 'sinhvienit_ads_pop', params);                                                  }
 }
}
/* ]]> */
</script>  
Đối với đoạn script này thì cửa sổ Popup chỉ mở ra khi bạn click chuột lần đầu tiên khi truy cập một blog, các thao tác click về sau cửa sổ popup sẽ khi còn xuất hiện như script đầu tiên, script đầu tiên chỉ cần bạn click là nó xuất hiện tab mới tần suất xuất hiện cao hơn script này. Hơn nữa script này sẽ lấy ngẫu nhiên trang web/blog trong urllist để xuất hiện.

Bước 4. Cuối cùng save template lại là xong.
Lưu lại template và xem kết quả! Nếu có vấn đề gì thắc mắc hãy để lại comment nhé! Chúc bạn thành công!

Đăng nhận xét