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

网页右下角漂浮广告代码(浏览器左下角网页广告)

admin 发布:2022-12-20 00:05 104


今天给各位分享网页右下角漂浮广告代码的知识,其中也会对浏览器左下角网页广告进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

求段网页右下角漂浮的JS代码,放广告用的!

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""

html xmlns=""

head

title不会被屏蔽的网页右下角漂浮窗口代码/title

FCK:meta http-equiv="content-type" content="text/html;charset=gb2312" /

style type="text/css"

#msg_win{border:1px solid #A67901;background:#EAEAEA;width:300px;position:absolute;right:0;font-size:12px;font-family:Arial;margin:0px;display:none;overflow:hidden;z-index:99;}

#msg_win .icos{position:absolute;top:2px;*top:0px;right:2px;z-index:9;}

.icos a{float:left;color:#833B02;margin:1px;text-align:center;font-weight:bold;width:14px;height:22px;line-height:22px;padding:1px;text-decoration:none;font-family:webdings;}

.icos a:hover{color:#fff;}

#msg_title{background:#FECD00;border-bottom:1px solid #A67901;border-top:1px solid #FFF;border-left:1px solid #FFF;color:#000;height:25px;line-height:25px;text-indent:5px;}

#msg_content{margin:0px;width:300px;height:300px;overflow:hidden;}

/style

/head

body

p style="height:1000px;"/p

div id="msg_win" style="display:block;top:490px;visibility:visible;opacity:1;"

div class="icos"a id="msg_min" title="最小化" href="javascript:void 0" _fcksavedurl="javascript:void 0"_/aa id="msg_close" title="关闭" href="javascript:void 0" _fcksavedurl="javascript:void 0"×/a/div

div id="msg_title"标题/div

div id="msg_content"

img src="" width="300" height="300" border="0"/

/div

/div

script language="javascript"

var Message={

set: function() {//最小化与恢复状态切换

var set=this.minbtn.status == 1?[0,1,'block',this.char[0],'最小化']:[1,0,'none',this.char[1],'恢复'];

this.minbtn.status=set[0];

this.win.style.borderBottomWidth=set[1];

this.content.style.display =set[2];

this.minbtn.innerHTML =set[3]

this.minbtn.title = set[4];

this.win.style.top = this.getY().top;

},

close: function() {//关闭

this.win.style.display = 'none';

window.onscroll = null;

},

setOpacity: function(x) {//设置透明度

var v = x = 100 ? '': 'Alpha(opacity=' + x + ')';

this.win.style.visibility = x=0?'hidden':'visible';//IE有绝对或相对定位内容不随父透明度变化的bug

this.win.style.filter = v;

this.win.style.opacity = x / 100;

},

show: function() {//渐显

clearInterval(this.timer2);

var me = this,fx = this.fx(0, 100, 0.1),t = 0;

this.timer2 = setInterval(function() {

t = fx();

me.setOpacity(t[0]);

if (t[1] == 0) {clearInterval(me.timer2) }

},10);

},

fx: function(a, b, c) {//缓冲计算

var cMath = Math[(a - b) 0 ? "floor": "ceil"],c = c || 0.1;

return function() {return [a += cMath((b - a) * c), a - b]}

},

getY: function() {//计算移动坐标

var d = document,b = document.body, e = document.documentElement;

var s = Math.max(b.scrollTop, e.scrollTop);

var h = /BackCompat/i.test(document.compatMode)?b.clientHeight:e.clientHeight;

var h2 = this.win.offsetHeight;

return {foot: s + h + h2 + 2+'px',top: s + h - h2 - 2+'px'}

},

moveTo: function(y) {//移动动画

clearInterval(this.timer);

var me = this,a = parseInt(this.win.style.top)||0;

var fx = this.fx(a, parseInt(y));

var t = 0 ;

this.timer = setInterval(function() {

t = fx();

me.win.style.top = t[0]+'px';

if (t[1] == 0) {

clearInterval(me.timer);

me.bind();

}

},10);

},

bind:function (){//绑定窗口滚动条与大小变化事件

var me=this,st,rt;

window.onscroll = function() {

clearTimeout(st);

clearTimeout(me.timer2);

me.setOpacity(0);

st = setTimeout(function() {

me.win.style.top = me.getY().top;

me.show();

},600);

};

window.onresize = function (){

clearTimeout(rt);

rt = setTimeout(function() {me.win.style.top = me.getY().top},100);

}

},

init: function() {//创建HTML

function $(id) {return document.getElementById(id)};

this.win=$('msg_win');

var set={minbtn: 'msg_min',closebtn: 'msg_close',title: 'msg_title',content: 'msg_content'};

for (var Id in set) {this[Id] = $(set[Id])};

var me = this;

this.minbtn.onclick = function() {me.set();this.blur()};

this.closebtn.onclick = function() {me.close()};

this.char=navigator.userAgent.toLowerCase().indexOf('firefox')+1?['_','::','×']:['0','2','r'];//FF不支持webdings字体

this.minbtn.innerHTML=this.char[0];

this.closebtn.innerHTML=this.char[2];

setTimeout(function() {//初始化最先位置

me.win.style.display = 'block';

me.win.style.top = me.getY().foot;

me.moveTo(me.getY().top);

},0);

return this;

}

};

Message.init();

/script

/body

/html

如何让浮动的广告在页面右侧固定,且随着屏幕的上移下移移动?

HTML代码(即需要漂浮的广告):

div class="christmas_ad" style="width:155px; height:220px; position:absolute; top:250px; right:25px;"

a href="javascript:void(0)" img src="/themes/mall/wowsai/topics/images/christmas_2012/christmasAcvance.png" border="0" //a

/div

js代码:前提是必须要引入jquery文件

script type="text/javascript"

$(function(){

  $(window).scroll(function(){

      var scrollTop = document.body.scrollTop || document.documentElement.scrollTop || 0;

      $(".christmas_ad").stop();

      var scrollTop2 = (scrollTop+160) - $(".christmas_ad").position().top;

      if(scrollTop 440){

          $(".christmas_ad:not(:animated)").animate({top:"+="+scrollTop2+"px"},1000);

      }else{

          $(".christmas_ad").css("top",370+"px");

      }

  })

})

/script

求一个网页右下角漂浮的JS代码

script language="JavaScript"

var delta=0.15

var collection;

function floaters() {

this.items = [];

this.addItem = function(id,x,y,content)

{

document.write('DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'"'+content+'/DIV');

var newItem = {};

newItem.object = document.getElementById(id);

newItem.x = x;

newItem.y = y;

this.items[this.items.length] = newItem;

}

this.play = function()

{

collection = this.items

setInterval('play()',10);

}

}

function play()

{

if(screen.width=800)

{

for(var i=0;icollection.length;i++)

{

collection[i].object.style.display = 'none';

}

return;

}

for(var i=0;icollection.length;i++)

{

var followObj = collection[i].object;

var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);

var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);

if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {

var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;

dx=(dx0?1:-1)*Math.ceil(Math.abs(dx));

followObj.style.left=followObj.offsetLeft+dx;

}

if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {

var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;

dy=(dy0?1:-1)*Math.ceil(Math.abs(dy));

followObj.style.top=followObj.offsetTop+dy;

}

followObj.style.display = '';

}

}

var theFloaters = new floaters();

theFloaters.addItem('followDiv1','document.body.clientWidth-90',60,'brEMBED src="1.swf" id="veicon" quality=high PLUGINSPAGE="" TYPE="application/x-shockwave-flash" WIDTH="90" HEIGHT="300"/EMBED');

theFloaters.addItem('followDiv2',0,60,'brEMBED src="1.swf" id="veicon" quality=high PLUGINSPAGE="" TYPE="application/x-shockwave-flash" WIDTH="100" HEIGHT="300"/EMBED');

theFloaters.play();

/script

!--adding code start--

SCRIPT FOR='veicon' EVENT='FSCommand()' LANGUAGE='JavaScript'

followDiv1.style.visibility='hidden';

followDiv2.style.visibility='hidden';

/script

!--adding code end--

带关闭的右下角漂浮广告代码 图片形式 要js的 发html的我不会用

你在漂浮的图片下面加一个关闭的按钮,然后给关闭按钮加一个点击事件,点击这个层隐藏就OK了

网页右边跟随滚动条上下移动的小广告是怎么做的?请高手给我代码

左栏浮动广告

script language=javascriptvar specialcode="DIV id=searchspe style='Z-INDEX: script language=javascriptvar specialcode="DIV id=searchspe style='Z-INDEX: 100; right: 1px; POSITION: absolute; TOP: 180px;'TABLE cellSpacing=0 cellPadding=0 width=150 style='border-left:1px solid #2E6287;border-top:1px solid #2E6287;border-right:1px solid #2E6287;font-size:12px;color:#ffffff; border-bottom-color:#2E6287; border-bottom-width:1px'TR bgcolor=#2E6287TD height=20 推荐↓/TDTD style='CURSOR: hand' onclick=searchspe.style.visibility='hidden' width=30关 闭/TD/TR/TABLEtable border='1' width='150' height='500' bordercolor='#2E6287'trtd广告内容/td/tr/table/DIV";document.write(specialcode);lastScrollY=0;function heartBeat0(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);if(percent0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollY=lastScrollY+percent;}window.setInterval("heartBeat0()",1);/script

右栏浮动广告

script language=javascriptvar specialcode="DIV id=searchspe style='Z-INDEX: 100; left: 1px; POSITION: absolute; TOP: 50px;'TABLE cellSpacing=0 cellPadding=0 width=360 style='border-left:1px solid #333333;border-top:1px solid #333333;border-right:1px solid #333333;font-size:12px;color:#ffffff'TR bgcolor=#2E6287TD height=20 推荐↓/TDTD style='CURSOR: hand' onclick=searchspe.style.visibility='hidden' width=30关 闭/TD/TR/TABLEtable border='1' width='150' id='table1' bordercolor='#2E6287' height='500'trtd广告内容/td/tr/table/DIV";document.write(specialcode);lastScrollY=0;function heartBeat0(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);if(percent0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollY=lastScrollY+percent;}window.setInterval("heartBeat0()",1);/script

左栏固定广告

DIV id=searchspe style='Z-INDEX: 100; left: 1px; POSITION: absolute; TOP: 50px;'TABLE cellSpacing=0 cellPadding=0 width=360 style='border-left:1px solid #333333;border-top:1px solid #333333;border-right:1px solid #333333;font-size:12px;color:#ffffff'TR bgcolor=#2E6287TD height=20 推荐↓/TDTD style='CURSOR: hand' onclick=searchspe.style.visibility='hidden' width=30关 闭/TD/TR/TABLE广告内容/DIV

右栏固定广告

DIV id=searchspe style='Z-INDEX: 100; right: 1px; POSITION: absolute; TOP: 50px;'TABLE cellSpacing=0 cellPadding=0 width=360 style='border-left:1px solid #333333;border-top:1px solid #333333;border-right:1px solid #333333;font-size:12px;color:#ffffff'TR bgcolor=#2E6287TD height=20 推荐↓/TDTD style='CURSOR: hand' onclick=searchspe.style.visibility='hidden' width=30关 闭/TD/TR/TABLE广告内容/DIV

漂浮广告代码

div id="img" style="position:absolute;; width: 200; height: 151"广告内容/div

script LANGUAGE="JavaScript"

var xPos = 20;

var yPos = 10;

img.style.left= xPos;

img.style.top = yPos;

var step = 1;

var delay = 30;

var width,height,Hoffset,Woffset;

var y = 1;

var x = 1;

var interval;

img.visibility = "visible";

function changePos()

{

width = document.body.clientWidth;

height = document.body.clientHeight;

Hoffset = img.offsetHeight;

Woffset = img.offsetWidth;

if (y)

{

yPos = yPos + step;

}

else

{

yPos = yPos - step;

}

if (yPos 0)

{

y = 1;

yPos = 0;

}

if (yPos = (height - Hoffset))

{

y = 0;

yPos = (height - Hoffset);

}

if (x)

{

xPos = xPos + step;

}

else

{

xPos = xPos - step;

}

if (xPos 0)

{

x = 1;

xPos = 0;

}

if (xPos = (width - Woffset))

{

x = 0;

xPos = (width - Woffset);

}

img.style.left = xPos + document.body.scrollLeft;

img.style.top = yPos + document.body.scrollTop;

}

function start()

{

interval = setInterval('changePos()', delay);

}

function pause_resume()

{

clearInterval(interval);

}

start();

/script

固定对联

DIV id=searchspe style='Z-INDEX: 100; right: 5px; POSITION: absolute; TOP: 50px;'TABLE cellSpacing=0 cellPadding=0 width=150 style='font-size:12px;color:#ffffff'TR bgcolor=#C54A00TD height=20 推荐↓/TDTD style='CURSOR: hand' onclick=searchspe.style.visibility='hidden' width=30关 闭/TD/TR/TABLE

广告内容/DIVDIV id=searchspe2 style='Z-INDEX: 100; left: 5px; POSITION: absolute; TOP: 50px;'TABLE cellSpacing=0 cellPadding=0 width=150 style='font-size:12px;color:#ffffff'TR bgcolor=#12BDFFTD height=20 推荐↓/TDTD style='CURSOR: hand' onclick=searchspe2.style.visibility='hidden' width=30关 闭/TD/TR/TABLE

广告内容/DIV

随动对联

script language=javascriptfunction close163news(){searchspe.style.visibility='hidden';searchspe2.style.visibility='hidden';} var specialcode="DIV id=searchspe style='Z-INDEX: 100; right: 1px; POSITION: absolute; TOP: 30px;'TABLE cellSpacing=0 cellPadding=0 width=150 style='font-size:12px;color:#ffffff'TR bgcolor=#C54A00TD height=20 推荐↓/TDTD style='CURSOR: hand' onclick='close163news()' width=30关 闭/TD/TR/TABLE广告内容/DIV";document.write(specialcode);lastScrollX=0;function heartBeat0(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollX);if(percent0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollX=lastScrollX+percent;}window.setInterval("heartBeat0()",1);var specialcode2="DIV id=searchspe2 style='Z-INDEX: 100; left: 1px; POSITION: absolute; TOP: 30px;'TABLE cellSpacing=0 cellPadding=0 width=150 style='font-size:12px;color:#ffffff'TR bgcolor=#12BDFFTD height=20 推荐↓/TDTD style='CURSOR: hand' onclick='close163news()' width=30关 闭/TD/TR/TABLE广告内容/DIV";document.write(specialcode2);lastScrollY=0;function heartBeat1(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);if(percent0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe2.style.pixelTop+=percent;lastScrollY=lastScrollY+percent;}window.setInterval("heartBeat1()",1);/script

qq好友上线广告代码

!-- 代码开始 请将下面的代码放到body结束标签之前--

DIV id=eMeng

style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 64px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 168px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 374px; HEIGHT: 115px; BACKGROUND-COLOR: #c9d3f3"

TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid"

cellSpacing=0 cellPadding=0 width="100%" bgColor=#cfdef4 border=0

TBODY

TR

TD

style="FONT-SIZE: 12px; BACKGROUND-IMAGE: none; COLOR: #0f2c8c"

width=30 height=24 /TD

TD

style="PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; BACKGROUND-IMAGE: none; COLOR: #1f336b; PADDING-TOP: 4px"

vAlign=center width="100%"span class="style13"本站提示/span/TD

TD vAlign=center align=right width=19 2px? padding-top: 2px;

padding-right:SPAN title=关闭

style="FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px"

onclick=closeDiv()×/SPAN/TD/TR

TR

TD

style="PADDING-RIGHT: 1px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 1px"

colSpan=3 height=90DIV

style="BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 13px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 13px; FONT-SIZE: 12px; PADDING-BOTTOM: 13px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%"

div align="left" span style="text-decoration: none"

FONT

color=#FF0000仿造qq好友上线br

center /center

/FONT/span/div

/DIV/td/tr/table

SCRIPT language=JavaScript

window.onload = getMsg;

window.onresize = resizeDiv;

window.onerror = function(){}

var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;

function getMsg()

{

try{

divTop = parseInt(document.getElementById("eMeng").style.top,10)

divLeft = parseInt(document.getElementById("eMeng").style.left,10)

divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)

divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)

docWidth = document.body.clientWidth;

docHeight = document.body.clientHeight;

document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight

document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth

document.getElementById("eMeng").style.visibility="visible"

objTimer = window.setInterval("moveDiv()",10)

}

catch(e){}

}

function resizeDiv()

{

try{

divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)

divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)

docWidth = document.body.clientWidth;

docHeight = document.body.clientHeight;

document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)

document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)

}

catch(e){}

}

function moveDiv()

{

try

{

if(parseInt(document.getElementById("eMeng").style.top,10) = (docHeight - divHeight + parseInt(document.body.scrollTop,10)))

{

window.clearInterval(objTimer)

objTimer = window.setInterval("resizeDiv()",1)

}

divTop = parseInt(document.getElementById("eMeng").style.top,10)

document.getElementById("eMeng").style.top = divTop - 1

}

catch(e){}

}

function closeDiv()

{

document.getElementById('eMeng').style.visibility='hidden';

if(objTimer) window.clearInterval(objTimer)

}

/SCRIPT

!-- 代码复制结束 --

网页右下角漂浮广告代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于浏览器左下角网页广告、网页右下角漂浮广告代码的信息别忘了在本站进行查找喔。

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

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


取消回复欢迎 发表评论:

分享到

温馨提示

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

联系我们反馈

立即下载