Xem bài viết rỏ hơn tại đây http://kenhdaihoc.com/forum/threads/7321-Code-quang-cao-giua-site.kdh
Code quảng cáo giữa site
Demo:
Demo:
Để làm được việc này các bạn chèn đoạn code sau vào vị trí muốn hiển thị (nếu muốn hiển thị tất cả các trang các bạn có thể chèn vào footer)
<script type="text/javascript" src="http://XXXXXXXX/jquery.js"></script>
<style type=”text/css”>#floating{ z-index: 450;position: absolute;width: 490px;height: 368px;} #overPage { background: black;z-index: 350;position: absolute;left: 0;top: 0; } </style><
!–Begin Adv Popup–>
<div id=”ctl00_ContentPlaceHolder1_Adv_Popup_pnAdv”>
<div id=”overPage”></div><div id=”floating”>
<img src=”link ảnh” width=”490″ height=”360″ usemap=”#offline”border=”0″ style=”cursor: pointer” />
</div><map name=”offline”>
<area shape=”rect” coords=”420,0,490,30″ onclick=”javascript:closeMe();” alt=”Close”style=”cursor: pointer” />
<area shape=”rect” coords=”0,30,490,330″ href=”Url site click vào ảnh ” target=”_blank” onclick=”javascript:closeMe();” style=”cursor: pointer” />
</map>!–Begin Adv Popup–> <div id=”ctl00_ContentPlaceHolder1_Adv_Popup_pnAdv”> <div id=”overPage”></div><div id=”floating”> <img src=”link ảnh” width=”490″ height=”360″ usemap=”#offline”border=”0″ style=”cursor: pointer” /> </div><map name=”offline”> <area shape=”rect” coords=”420,0,490,30″ onclick=”javascript:closeMe();” alt=”Close”style=”cursor: pointer” /> <area shape=”rect” coords=”0,30,490,330″ href=”Url site click vào ảnh ” target=”_blank” onclick=”javascript:closeMe();” style=”cursor: pointer” /> </map>!–Begin Adv Popup–> <div id=”ctl00_ContentPlaceHolder1_Adv_Popup_pnAdv”> <div id=”overPage”></div><div id=”floating”> <img src=”link ảnh” width=”490″ height=”360″ usemap=”#offline”border=”0″ style=”cursor: pointer” /> </div><map name=”offline”> <area shape=”rect” coords=”420,0,490,30″ onclick=”javascript:closeMe();” alt=”Close”style=”cursor: pointer” /> <area shape=”rect” coords=”0,30,490,330″ href=”Url site click vào ảnh ” target=”_blank” onclick=”javascript:closeMe();” style=”cursor: pointer” /> </map><script language=”javascript” type=”text/javascript”>var lastScroll;var delay = 30;var speed = 500;var img_w = 490;var img_h = 360;function centerIt()
{$(“#overPage”).css(“width”, $(window).width())
;$(“#overPage”).css(“height”, $(document).height());$(“#floating”).css(“left”, $(window).width() / 2 – img_w / 2);
$(“#floating”).css(“top”, $(window).height() / 2 – img_h / 2 + $(document).scrollTop());}$(document).ready(function() {$(“#overPage”).css(“opacity”, 0.7);
$(“#overPage,#floating”).show();centerIt();
});
$(window).scroll(function() {setTimeout(function()
{ ani(); }, delay);lastScroll = new Date().getTime();});
$(window).resize(function() {centerIt();});function ani()
{if ((new Date().getTime() – lastScroll) >= (delay – 20))
{$(“#floating”).animate({ top: ($(window).height() / 2 – img_h / 2 + $(document).scrollTop())
}, speed);
}}
function closeMe()
{$(“#overPage,#floating”).hide();}
</script> {$(“#overPage”).css(“width”, $(window).width()) ;$(“#overPage”).css(“height”, $(document).height());$(“#floating”).css(“left”, $(window).width() / 2 – img_w / 2); $(“#floating”).css(“top”, $(window).height() / 2 – img_h / 2 + $(document).scrollTop());}$(document).ready(function() {$(“#overPage”).css(“opacity”, 0.7);$(“#overPage,#floating”).show();centerIt();});$(window).scroll(function() {setTimeout(function(){ ani(); }, delay);lastScroll = new Date().getTime();});$(window).resize(function() {centerIt();});function ani() {if ((new Date().getTime() – lastScroll) >= (delay – 20)){$(“#floating”).animate({ top: ($(window).height() / 2 – img_h / 2 + $(document).scrollTop()) }, speed);}}function closeMe() {$(“#overPage,#floating”).hide();}</script> {$(“#overPage”).css(“width”, $(window).width()) ;$(“#overPage”).css(“height”, $(document).height());$(“#floating”).css(“left”, $(window).width() / 2 – img_w / 2); $(“#floating”).css(“top”, $(window).height() / 2 – img_h / 2 + $(document).scrollTop());}$(document).ready(function() {$(“#overPage”).css(“opacity”, 0.7);$(“#overPage,#floating”).show();centerIt();});$(window).scroll(function() {setTimeout(function() { ani(); }, delay);lastScroll = new Date().getTime();});$(window).resize(function() {centerIt();});function ani() {if ((new Date().getTime() – lastScroll) >= (delay – 20)) {$(“#floating”).animate({ top: ($(window).height() / 2 – img_h / 2 + $(document).scrollTop()) }, speed);}}function closeMe() {$(“#overPage,#floating”).hide();}</script></div><!–End Adv Popup–>
Thay đổi các dòng màu đỏ cho đúng nè.Thêm code mới: dạng get cookie chỉ hiện 1 lần
<div id="quangcaochan" style="width:0px;height:0px;position:fixed;background-color:white;z-index:100">
<script> var cookie_quangcaochan = SVIT_ADS_GetCookie('dj247net_quangcaochan_info'); if (cookie_quangcaochan != '') { $("#quangcaochan").css('display','none'); $("#quangcaochan").html(''); } </script> <a id='tatquangcaochan' style="float:right;color:grey;cursor:pointer">Tắt quảng cáo (X)</a> <a href="http://domain lick baner sẽ đến" target="_blank"><img src="http://doamin/banner.png" width="440px" height="280px"/></a> <script> var w = $(window).width()/2 - 320; var h = $(window).height()/2 - 240; $("#quangcaochan").css({'top':h,'left':w,'width':'640px','height':'480px','z-index':'100000'}); $("#tatquangcaochan").click(function(){ $("#quangcaochan").html(''); $("#quangcaochan").css('display','none'); var Time_expires = 60*60*10*1000; SVIT_ADS_SetCookie('dj247net_quangcaochan_info','true',Time_expires); }); </script> </div></div>
0 nhận xét