当前位置:首页 > 代码 > 正文

移动广告代码(手机广告代码)

admin 发布:2022-12-19 19:46 109


本篇文章给大家谈谈移动广告代码,以及手机广告代码对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

jquery 广告,上下左右满屏移来移去,遇到窗口边缘就会相反移动(一个浮动的小广告),速求代码!

titleJS浮动广告/title 

style type="text/css" 

img{border:0;} 

/style 

SCRIPT type=text/javascript 

function addEvent(obj,evtType,func,cap){ 

cap=cap||false; 

if(obj.addEventListener){ 

obj.addEventListener(evtType,func,cap); 

return true; 

}else if(obj.attachEvent){ 

if(cap){ 

obj.setCapture(); 

return true; 

}else{ 

return obj.attachEvent("on" + evtType,func); 

}else{ 

return false; 

function getPageScroll(){ 

var xScroll,yScroll; 

if (self.pageXOffset) { 

xScroll = self.pageXOffset; 

} else if (document.documentElement  document.documentElement.scrollLeft){ 

xScroll = document.documentElement.scrollLeft; 

} else if (document.body) { 

xScroll = document.body.scrollLeft; 

if (self.pageYOffset) { 

yScroll = self.pageYOffset; 

} else if (document.documentElement  document.documentElement.scrollTop){ 

yScroll = document.documentElement.scrollTop; 

} else if (document.body) { 

yScroll = document.body.scrollTop; 

arrayPageScroll = new Array(xScroll,yScroll); 

return arrayPageScroll; 

function GetPageSize(){ 

var xScroll, yScroll; 

if (window.innerHeight  window.scrollMaxY) { 

xScroll = document.body.scrollWidth; 

yScroll = window.innerHeight + window.scrollMaxY; 

} else if (document.body.scrollHeight  document.body.offsetHeight){ 

xScroll = document.body.scrollWidth; 

yScroll = document.body.scrollHeight; 

} else { 

xScroll = document.body.offsetWidth; 

yScroll = document.body.offsetHeight; 

var windowWidth, windowHeight; 

if (self.innerHeight) { 

windowWidth = self.innerWidth; 

windowHeight = self.innerHeight; 

} else if (document.documentElement  document.documentElement.clientHeight) { 

windowWidth = document.documentElement.clientWidth; 

windowHeight = document.documentElement.clientHeight; 

} else if (document.body) { 

windowWidth = document.body.clientWidth; 

windowHeight = document.body.clientHeight; 

if(yScroll  windowHeight){ 

pageHeight = windowHeight; 

} else { 

pageHeight = yScroll; 

if(xScroll  windowWidth){ 

pageWidth = windowWidth; 

} else { 

pageWidth = xScroll; 

arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 

return arrayPageSize; 

var AdMoveConfig=new Object(); 

AdMoveConfig.IsInitialized=false; 

AdMoveConfig.ScrollX=0; 

AdMoveConfig.ScrollY=0; 

AdMoveConfig.MoveWidth=0; 

AdMoveConfig.MoveHeight=0; 

AdMoveConfig.Resize=function(){ 

var winsize=GetPageSize(); 

AdMoveConfig.MoveWidth=winsize[2]; 

AdMoveConfig.MoveHeight=winsize[3]; 

AdMoveConfig.Scroll(); 

AdMoveConfig.Scroll=function(){ 

var winscroll=getPageScroll(); 

AdMoveConfig.ScrollX=winscroll[0]; 

AdMoveConfig.ScrollY=winscroll[1]; 

addEvent(window,"resize",AdMoveConfig.Resize); 

addEvent(window,"scroll",AdMoveConfig.Scroll); 

function AdMove(id){ 

if(!AdMoveConfig.IsInitialized){ 

AdMoveConfig.Resize(); 

AdMoveConfig.IsInitialized=true; 

var obj=document.getElementById(id); 

obj.style.position="absolute"; 

var W=AdMoveConfig.MoveWidth-obj.offsetWidth; 

var H=AdMoveConfig.MoveHeight-obj.offsetHeight; 

var x = W*Math.random(),y = H*Math.random(); 

var rad=(Math.random()+1)*Math.PI/6; 

var kx=Math.sin(rad),ky=Math.cos(rad); 

var dirx = (Math.random()0.5?1:-1), diry = (Math.random()0.5?1:-1); 

var step = 1; 

var interval; 

this.SetLocation=function(vx,vy){x=vx;y=vy;} 

this.SetDirection=function(vx,vy){dirx=vx;diry=vy;} 

obj.CustomMethod=function(){ 

obj.style.left = (x + AdMoveConfig.ScrollX) + "px"; 

obj.style.top = (y + AdMoveConfig.ScrollY) + "px"; 

rad=(Math.random()+1)*Math.PI/6; 

W=AdMoveConfig.MoveWidth-obj.offsetWidth; 

H=AdMoveConfig.MoveHeight-obj.offsetHeight; 

x = x + step*kx*dirx; 

if (x  0){dirx = 1;x = 0;kx=Math.sin(rad);ky=Math.cos(rad);} 

if (x  W){dirx = -1;x = W;kx=Math.sin(rad);ky=Math.cos(rad);} 

y = y + step*ky*diry; 

if (y  0){diry = 1;y = 0;kx=Math.sin(rad);ky=Math.cos(rad);} 

if (y  H){diry = -1;y = H;kx=Math.sin(rad);ky=Math.cos(rad);} 

this.Run=function(){ 

var delay = 10; 

interval=setInterval(obj.CustomMethod,delay); 

obj.onmouseover=function(){clearInterval(interval);} 

obj.onmouseout=function(){interval=setInterval(obj.CustomMethod, delay);} 

/SCRIPT 

DIV id=ad1 style="Z-INDEX: 5" 

!--漂浮开始-- 

A href="" 

target=_blankIMG src=""/A 

!--漂浮结束-- 

/DIV 

SCRIPT type=text/javascript!-- 

var ad1=new AdMove("ad1"); 

ad1.Run(); 

        //多组漂浮 

        //var ad1=new AdMove("ad2"); 

//ad2.Run(); 

//-- 

/SCRIPT

请问google的移动广告代码怎样转换成ubb代码?

不能转换的,google adsense多次强调不能修改代码,否则以违规处理

求网站左右空白地方悬浮对联广告代码,可以上下移动的那种

先在你的网站主目录建立JS文件,再建立一个JS文件(如ad-01.js)

打开文本将下面代码复制到其中,保存格式为js

function initEcAd() {

document.all.AdLayer1.style.posTop = -200;

document.all.AdLayer1.style.visibility = 'visible'

document.all.AdLayer2.style.posTop = -200;

document.all.AdLayer2.style.visibility = 'visible'

MoveLeftLayer('AdLayer1');

MoveRightLayer('AdLayer2');

}

function MoveLeftLayer(layerName) {

var x = 5;

var y = 100;// 左侧广告距离页首高度

var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;

var y = document.body.scrollTop + y - diff;

eval("document.all." + layerName + ".style.posTop = parseInt(y)");

eval("document.all." + layerName + ".style.posLeft = x");

setTimeout("MoveLeftLayer('AdLayer1');", 20);

}

function MoveRightLayer(layerName) {

var x = 5;

var y = 100;// 右侧广告距离页首高度

var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;

var y = document.body.scrollTop + y - diff;

eval("document.all." + layerName + ".style.posTop = y");

eval("document.all." + layerName + ".style.posRight = x");

setTimeout("MoveRightLayer('AdLayer2');", 20);

}

document.write("div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'a href='http://你链接的网址' target='_blank'img src=你链接的图片 border='0'/a/div"

+"div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'a href='http://你链接的网址' target='_blank'img src=你链接的图片 border='0'/a/div");

initEcAd()

// JavaScript Document

还没结束呢,,然后将 script src="js/ad-01.js" language="JavaScript"/script放在body中。就OK了,还不明白就加我QQ:9142673。我指导你。。

中国移动的这种短信广告怎么取消?

取消10658200代码短信,新疆移动客户如不想接收此信息,可拨打10086人工服务反馈取消。

移动广告代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于手机广告代码、移动广告代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/21279.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载