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

手机顶部漂浮广告代码(手机网页底部广告)

admin 发布:2022-12-19 19:12 133


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

本文目录一览:

悬浮广告代码,带链接的

这是左侧漂浮的广告代码

SCRIPT FOR=window EVENT=onload LANGUAGE="javascript"

initAd();//载入页面后,调用函数initAd()

/SCRIPT

script language="javascript"

!--

function initAd() {

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

//设置onLoad事件激发以后,广告层相对于固定后的y方向位置

document.all.AdLayer.style.visibility = 'visible'//设置层为可见

MoveLayer('AdLayer');//调用函数MoveLayer()

}

function MoveLayer(layerName) {

var x = 0;//浮动广告层固定于浏览器的x方向位置

var y = 408;//浮动广告层固定于浏览器的y方向位置

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

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

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

eval("document.all." + layerName + ".style.posright = x");//移动广告层

setTimeout("MoveLayer('AdLayer');", 0);//设置20毫秒后再调用函数MoveLayer()

}

//--

/script

div id=AdLayer style='position:absolute; width:61px; height:59px; z-index:20; visibility:hidden;; left: 0px; top: 100px' a href="#"img border="0" src="images/jixiangwu.gif" width="81" height="88"/a/div

谁可以给个JS漂浮广告的关闭代码?

function closead(){

document.getElementById("left").style.display="none";

document.getElementById("right").style.display="none";

}

div id="left"

p/p

a href="javascript:closead();" title="关闭广告"×关闭/a

/div

求一个页面上漂浮着两个浮动广告的js代码

html

head

title漂浮的图片/title

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

!--head头部代码开始--

script language="JavaScript" SRC="moveobj.js" /script

script

var chip1;

var chip2;

var chip3;

//根据使用的图片的多少增加或减少上面相应代码;

function pagestart()

{checkbrOK();

chip1=new Chip("chip1",160,80);

chip2=new Chip("chip2",60,80);

//根据使用的图片的多少增加或减少上面的相应代码

if(brOK)

{ movechip("chip1");

movechip("chip2");

//根据使用的图片的多少增加或减少上面的相应代码

}

}

/script

!--代码结束--

link rel="stylesheet" href="../style.css"

body onLoad="pagestart();" onUnload="if(brOK) {stopme('chip1'); stopme('chip2');}" bgcolor="#FFFFFF" text="#000000"

DIV ID="chip1" STYLE="position:absolute; width:47; height:68;"

A HREF="rm/ad1.htm"IMG SRC="ballon1.jpg" BORDER=0/a

/DIV

DIV ID="chip2" STYLE="position:absolute; width:47; height:68;"

A HREF="rm/ad2.htm"IMG SRC="ballon2.jpg" BORDER=0/a

/DIV

center

p

script src="moveobj.js"/script

/center

/body

/html

页面悬浮广告代码

脚本说明:

把如下代码加入body区域中

SCRIPT FOR=window EVENT=onload LANGUAGE="JavaScript"

initAd();//载入页面后,调用函数initAd()

/SCRIPT

script language="JavaScript"

!--

function initAd() {

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

//设置onLoad事件激发以后,广告层相对于固定后的y方向位置

document.all.AdLayer.style.visibility = 'visible'//设置层为可见

MoveLayer('AdLayer');//调用函数MoveLayer()

}

function MoveLayer(layerName) {

var x = 600;//浮动广告层固定于浏览器的x方向位置

var y = 300;//浮动广告层固定于浏览器的y方向位置

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

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

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

eval("document.all." + layerName + ".style.posLeft = x");//移动广告层

setTimeout("MoveLayer('AdLayer');", 20);//设置20毫秒后再调用函数MoveLayer()

}

//--

/script

!--下面为一个ID为AdLayer的层(如ID名不为AdLayer,

上面MoveLayer()内的AdLayer也要作相应修改),包括一张带链接的图片--

div id=AdLayer style='position:absolute; width:61px; height:59px; z-index:20; visibility:hidden;; left: 600px; top: 300px'

a href=""img src='' border="0" height="31" width="88"/a

/div

JS漂浮广告代码

给个简单的 也需引入jquery

Html:

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

title/title

script type="text/javascript" src="jquery-1.4.2.min.js"/script

script type="text/javascript"

$(function(){

$('#showWin').click(showWin);

function showWin(){

$('#floatWin').show('slow');

}

})

/script

/head

body

button id="showWin"显示窗口/button

div id="floatWin"

style="right:0px;bottom:0px;display:none; width: 200px;height: 200px; background-color: #cccccc;position: absolute;"

/div

/body

/html

最近项目里正好有类似需求 代码给出来供你研究下 需要jQuery支持

有什么疑问可以hi我

(function(){

$(function(){

$.ajax({

url: messagePath+'messageBox.do',

// dataType:'json',

success:function(json){

alert(json);

showMessages(json);

}

});

})

function showMessages(json){

if(json.messagecount0){

var messageBox ="div id=\"OTOS_MESSAGEBOX_CONTAINER\""+

" table id=\"OTOS_MESSAGEBOX_HEADER\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\""+

" tr"+

" td id=\"OTOS_MESSAGEBOX_HEADER_TEXT\"/td"+

" td align=\"right\" width=\"20\"img id=\"OTOS_MESSAGEBOX_CLOSE\" style=\"cursor: pointer;\" src=\"resources/images/close.gif\"/td"+

" /tr"+

" /table"+

" table id=\"OTOS_MESSAGEBOX_CONTEXT_TITLE_TABLE\" width=\"100%\""+

" tr id=\"OTOS_MESSAGEBOX_CONTEXT_TABLE_HEADER\""+

" td标题/td"+

" td width=\"50\"类型/td"+

" td width=\"40\"发送人/td"+

" /tr"+

" /table"+

" div id=\"OTOS_MESSAGEBOX_CONTEXT\""+

" table id=\"OTOS_MESSAGEBOX_CONTEXT_TABLE\" width=\"100%\"/table"+

" /div"+

"/div";

$('body').append(messageBox);

// $('#OTOS_MESSAGEBOX_CONTAINER').jqDrag("#OTOS_MESSAGEBOX_HEADER");

$('#OTOS_MESSAGEBOX_HEADER_TEXT').text("您有"+json.messagecount+"条未读消息!");

$('#OTOS_MESSAGEBOX_CLOSE').bind('click',closeMessageBox);

$('#OTOS_MESSAGEBOX_CONTAINER').show('slow');

for(var i=0;ijson.list.length;i++){

var map = json.list[i];

$('#OTOS_MESSAGEBOX_CONTEXT_TABLE').append("tr onClick=\"toViewMessage("+map.id+",+"+map.mid+")\" class=\"OTOS_MESSAGEBOX_CONTEXT_TABLE_TR\"td"+cutTitle(map.title)+"/tdtd width=\"50\" nowarp"+map.type+"/tdtd width=\"40\""+map.sender+"/td/tr");

}

$('#OTOS_MESSAGEBOX_CONTEXT_TABLE').verticalRoll({parentid:'OTOS_MESSAGEBOX_CONTEXT'});

}

}

// 纵向滚动

$.fn.verticalRoll = function(options) {

var opts = $.extend({}, $.fn.verticalRoll.defaults, options);

if(!opts.parentid||$('#'+opts.parentid).size()1){

alert('父级不存在');

return false;

}

var $p = $('#'+opts.parentid);

var $t = $(this);

if($t.attr('tagName')!='TABLE'){

alert('不是table');

return false;

}

var s = $t.find('tr').size()

$p.css('overflow','hidden');

$t.css('position','absolute');

if(s5){

window.setInterval(function(){

var temp = $t.find('tr:first');

temp.fadeOut('slow',function(){

$t.append(temp);

temp.show();

})

},2000)

}else{

return false;

}

$.fn.verticalRoll.defaults = {}

}

})(jQuery);

function closeMessageBox(){

$('#OTOS_MESSAGEBOX_CONTAINER').hide('slow');

$('#OTOS_MESSAGEBOX_CONTAINER').fadeOut();

}

function cutTitle(title){

var temp;

if(title.length8){

temp = title.substring(0,8)+"...";

return temp

}else{

return title;

}

}

function toViewMessage(id,rid){

window.location.href = "messagesUserList.do?id="+id+"rid="+rid;

}

Css文件

@CHARSET "UTF-8";

#OTOS_MESSAGEBOX_CONTAINER {

position: absolute;

width: 240px;

height: 145px;

border: 1px solid #81b8ff;

background-color: #deecfd;

right: 0px;

bottom: 0px;

overflow:hidden;

display: none;

}

#OTOS_MESSAGEBOX_CONTAINER TD{

white-space: nowrap;

overflow: hidden;

height: 18px;

}

#OTOS_MESSAGEBOX_HEADER {

cursor: move;

border-bottom: 1px solid #81b8ff;

background-color: #9ACDFE;

overflow:hidden;

}

#OTOS_MESSAGEBOX_HEADER td {

padding: 2px;

color: #ffffff;

overflow:hidden;

}

#OTOS_MESSAGEBOX_CONTEXT {

position: relative;

height: 102px;

overflow:hidden;

}

#OTOS_MESSAGEBOX_CONTEXT td{

white-space: nowrap;

overflow: hidden;

}

#OTOS_MESSAGEBOX_HEADER_TEXT {

font-weight: bold;

overflow:hidden;

}

#OTOS_MESSAGEBOX_FOOTER {

position: relative;;

bottom: 0px;;

padding-right: 2px;;

text-align: right;

overflow:hidden;

}

.OTOS_MESSAGEBOX_CONTEXT_TABLE_TR{

cursor:pointer;

color: #336699;

overflow:hidden;

}

#OTOS_MESSAGEBOX_CONTEXT_TABLE_HEADER td{

overflow:hidden;

font-weight: bold;

overflow:hidden;

}

求一个右下角的漂浮广告代码?

右下角漂浮广告代码使用方法(一): 将以下代码以**.js文件形式保存,在模板中调用这个js文件即可

(备注该代码的图片大小为250*150 代码里面有参数自己看下就知道了)document.writeln("div id=\"qqaddiv\" style=\"position:absolute; z-index: 100;\" ");

document.writeln("a href=链接地址 target=_blankimg src=图片链接地址 border=0/a");

document.writeln("/div");

var bodyfrm = ( document.compatMode.toLowerCase()=="css1compat" ) ? document.documentElement : document.body;

var adst = document.getElementById("qqaddiv").style;

adst.top = ( bodyfrm.clientHeight - 150 ) + "px";

adst.left = ( bodyfrm.clientWidth - 250 ) + "px";

function moveR() {

adst.top = ( bodyfrm.scrollTop + bodyfrm.clientHeight - 150 ) + "px";

adst.left = ( bodyfrm.scrollLeft + bodyfrm.clientWidth - 250 ) + "px";

}

setInterval("moveR();", 80); 右下角漂浮广告代码使用方法(二): var qq_etewidth = 259;

var qq_eteheight = 158;

var qq_banner_filename = "广告图片链接地址";

var qq_gotoUrl = '广告链接地址';document.write("div id=eteUnionUpFloat style='margin:0px;padding-bottom:300px;z-index: 10;position:absolute;width:"+qq_etewidth+"px;height:"+qq_eteheight+"px;'")

document.write("a href='"+qq_gotoUrl+"' target='_blank'img src='"+qq_banner_filename+"' border='0' style='cursor: hand;' width='"+qq_etewidth+"' height='"+qq_eteheight+"'/a")

document.write("/div")

var bodyfrm = ( document.compatMode.toLowerCase()=="css1compat" ) ? document.documentElement : document.body;

var adst = document.getElementById("eteUnionUpFloat").style;

adst.top = ( bodyfrm.clientHeight - qq_eteheight ) + "px";

adst.left = ( bodyfrm.clientWidth - qq_etewidth ) + "px";

function moveR() {

adst.top = ( bodyfrm.scrollTop + bodyfrm.clientHeight - qq_eteheight ) + "px";

adst.left = ( bodyfrm.scrollLeft + bodyfrm.clientWidth - qq_etewidth ) + "px";

}

var objTimer=setInterval("moveR();", 100);function CloseX(){

adst.display='none';

}function ete_closediv()

{

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

if(objTimer) window.clearInterval(objTimer)

}

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

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

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


取消回复欢迎 发表评论:

分享到

温馨提示

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

联系我们反馈

立即下载