漂泊广告是什么?漂泊广告怎样设置

在上一篇文章中甲爪同盟有简短的提到了漂泊广告!漂泊广告在广告同盟中网站主和现在互联网网页广告运营的比较多,而且从结果来看漂泊广告也是异常不错的!然则个能够一般的站长对漂泊广告相识不够深,或许不知道怎样设置漂泊广告!所以甲爪同盟就对漂泊广告是什么?漂泊广告怎样设置做出细致的解答!

漂泊广告( Floating Advertising)是指漂泊在网站首页或各版块、帖子等页面的漂移情势的广告。可所以图片,可所以flash。首页和各版块帖子页面都可所以自力的广告位。能够自动顺应屏幕分辨率,,不被任何网页元素遮挡,同时能够支撑多个图片漂泊。漂泊式广告就象永不消逝的幽魂,在阅读网页的时刻,它会一向沿着设想好的线路漂移,设想线路不好的漂泊式广告会疏散网民的注意力,影响一般的阅读所以漂泊广告在设置的时刻也需依据实况来调解用户体验!

而漂泊广告怎样设置呢?实在网页漂泊广告,悬停广告等广告款式在网上也有许多漂泊广告完成代码代码!所以甲爪广告同盟就枚举三种漂泊广告款式!

第一种 漂泊广告 不相符W3C
JavaScript漂泊广告代码,很不错,代码精简,不过一次只要漂一个

<html> 
<head> 
<title>漂泊广告</title> 
<body> 
<div id="codefans_net" style="position:absolute"> 
<!--链接地点--><a href="#" target="_blank"> 
<!--图片地点--><img src="/images/logo.gif" border="0"> 
</a> 
</div> 
<script> 
var x = 50,y = 60 
var xin = true, yin = true 
var step = 1 
var delay = 10 
var obj=document.getElementById("codefans_net") 
function float() { 
var L=T=0 
var R= document.body.clientWidth-obj.offsetWidth 
var B = document.body.clientHeight-obj.offsetHeight 
obj.style.left = x + document.body.scrollLeft 
obj.style.top = y + document.body.scrollTop 
x = x + step*(xin?1:-1) 
if (x < L) { xin = true; x = L} 
if (x > R){ xin = false; x = R} 
y = y + step*(yin?1:-1) 
if (y < T) { yin = true; y = T } 
if (y > B) { yin = false; y = B } 
} 
var itl= setInterval("float()", delay) 
obj.onmouseover=function(){clearInterval(itl)} 
obj.onmouseout=function(){itl=setInterval("float()", delay)} 
</script> 
</body> 
</html> 

第二种 漂泊广告 不相符规范
Js漂泊广告代码,比较典范的浮动广告,到现还很有用,比较合适站长,这类代码是必备的。

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>漂泊广告</title> 
</head> 
<body> 
<DIV id=img1 style="Z-INDEX: 100; LEFT: 2px; WIDTH: 59px; POSITION: absolute; TOP: 43px; HEIGHT: 61px; 
visibility: visible;"><a href="http://www.jiazhua.com" target="_blank"><img src="/images/logo.gif" width="80" height="80" border="0"></a></DIV> 
<SCRIPT> 
var xPos = 300; 
var yPos = 200; 
var step = 1; 
var delay = 30; 
var height = 0; 
var Hoffset = 0; 
var Woffset = 0; 
var yon = 0; 
var xon = 0; 
var pause = true; 
var interval; 
img1.style.top = yPos; 
function changePos() 
{ 
width = document.body.clientWidth; 
height = document.body.clientHeight; 
Hoffset = img1.offsetHeight; 
Woffset = img1.offsetWidth; 
img1.style.left = xPos + document.body.scrollLeft; 
img1.style.top = yPos + document.body.scrollTop; 
if (yon) 
{yPos = yPos + step;} 
else 
{yPos = yPos - step;} 
if (yPos < 0) 
{yon = 1;yPos = 0;} 
if (yPos >= (height - Hoffset)) 
{yon = 0;yPos = (height - Hoffset);} 
if (xon) 
{xPos = xPos + step;} 
else 
{xPos = xPos - step;} 
if (xPos < 0) 
{xon = 1;xPos = 0;} 
if (xPos >= (width - Woffset)) 
{xon = 0;xPos = (width - Woffset); } 
} 

function start() 
{ 
img1.visibility = "visible"; 
interval = setInterval('changePos()', delay); 
} 
function pause_resume() 
{ 
if(pause) 
{ 
clearInterval(interval); 
pause = false;} 
else 
{ 
interval = setInterval('changePos()',delay); 
pause = true; 
} 
} 
start(); 
</SCRIPT> 
</body> 
</html> 

第三种 相符W3C的漂泊广告代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>相符W3C的漂泊广告代码-甲爪广告同盟</title> 
</head> 
<body> 
<script> 
document.write ("<DIV id=img1 style='Z-INDEX: 100; LEFT: 2px; WIDTH: 252px; POSITION: absolute; TOP: 43px; HEIGHT: 172px; ") 
document.write (" visibility: visible;'> ") 
document.write (" <a href='http://s.jb51.net' target='_blank'> ") 
document.write (" <img src='/upload/201204/20120411210123566.gif'style=border:none;/> ") 
document.write (" </a></DIV> ") 
var xPos = 300; 
var yPos = 200; 
var step = 1; 
var delay = 8; 
var height = 0; 
var Hoffset = 0; 
var Woffset = 0; 
var yon = 0; 
var xon = 0; 
var pause = true; 
var interval; 
img1.style.top = yPos; 
function changePos() 
{ 
width = document.documentElement.clientWidth; 
height = document.documentElement.clientHeight; 
Hoffset = img1.offsetHeight; 
Woffset = img1.offsetWidth; 
img1.style.left = xPos + document.documentElement.scrollLeft; 
img1.style.top = yPos + document.documentElement.scrollTop; 
if (yon) 
{yPos = yPos + step;} 
else 
{yPos = yPos - step;} 
if (yPos < 0) 
{yon = 1;yPos = 0;} 
if (yPos >= (height - Hoffset)) 
{yon = 0;yPos = (height - Hoffset);} 
if (xon) 
{xPos = xPos + step;} 
else 
{xPos = xPos - step;} 
if (xPos < 0) 
{xon = 1;xPos = 0;} 
if (xPos >= (width - Woffset)) 
{xon = 0;xPos = (width - Woffset); } 
} 
function start() 
{ 
img1.visibility = "visible"; 
interval = setInterval('changePos()', delay); 
} 
function pause_resume() 
{ 
if(pause) 
{ 
clearInterval(interval); 
pause = false;} 
else 
{ 
interval = setInterval('changePos()',delay); 
pause = true; 
} 
} 
start(); 
</script> 
</body> 
</html> 

Ps:以上代码如果在尝试的时刻!须要事前相识是不是可行!

    原文作者:甲爪广告联盟
    原文地址: https://segmentfault.com/a/1190000008175695
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞