css漂浮广告代码(html漂浮广告代码)

http://www.itjxue.com  2023-02-22 01:36  来源:未知  点击次数: 

怎么用css样式表实现网页上的广告的漂浮啊?

css只能实现广告漂浮在一个指定的地方,不能动的,如果需要移动的广告就必需用js代码实现的

css漂浮代码为:position:absolute;

谁教我怎么使用淘宝公告漂浮的代码啊?

漂浮广告代码 代码如下

div id="ad" style="position:absolute"

a href="" target="_blank"

img src="" 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("ad")

function floatAD() {

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("floatAD()", delay)

obj.onmouseover=function(){clearInterval(itl)}

obj.onmouseout=function(){itl=setInterval("floatAD()", delay)}

/script

把上面的代码放在需要放置广告的页面HTML代码的body/body之间

你可以把图片和地址换掉。还有就是你可以关闭这个问题,自己去百度里搜索,肯定有很多的,还有就是一定的编辑器会解析掉一定的代码你也要注意,自己搜索代码不断的联系,这样对你对代码的了解也是很好的哦。

网站漂浮广告代码怎么写

script type="text/javascript"

function hidead()

{document.getElementById("ad").style.display="none";}

/script

div id="ad" style="position:absolute"

!--放广告代码--DIV onClick="hidead();" style="FONT-SIZE: 9pt; CURSOR: hand" align=right关闭广告×/DIV/div

script

var x = 80,y = 80

var xin = true, yin = true

var step = 1

var delay = 1

var obj=document.getElementById("ad")

function floatAD() {

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("floatAD()", delay)

obj.onmouseover=function(){clearInterval(itl)}

obj.onmouseout=function(){itl=setInterval("floatAD()", delay)}

/script

js或者CSS带关闭的漂浮广告代码

htmlheadtitle固定在底部的漂浮广告/title/headbodyscript LANGUAGE='JavaScript'var ad_float_left_src="http:/images/logo.gif";var ad_float_left_url = "http:";var ad_float_left_type = "";document.ns = navigator.appName == "Microsoft Internet Explorer"var imgheight_closevar imgleftwindow.screen.width800 ? imgheight_close=120:imgheight_close=120window.screen.width800 ? imgleft=15:imgleft=122function myload(){myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight_close;myleft.style.left=imgleft;leftmove();}function leftmove(){myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight_close;myleft.style.left=imgleft;setTimeout("leftmove();",50)}function MM_reloadPage(init) {if (init==true) with (navigator) {if ((appName=="Netscape")(parseInt(appVersion)==4)) {document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}MM_reloadPage(true)function close_float_left(){myleft.style.visibility='hidden';}if(document.ns){document.write("div id=myleft style='position: absolute;width:80;top:300;left:5;visibility: visible;z-index: 1'styleA.closefloat:link,A.refloat:visited {text-decoration:none;color:#000000;font-size:12px}A.closefloat:active,A.refloat:hover {text-decoration:underline;color:#0000FF;font-size:12px}/styletable border=0 cellpadding=0 cellspacing=0trtd");if(ad_float_left_type!="swf")document.write("a href='" + ad_float_left_url + "' target = '_blank'img src='" + ad_float_left_src + "' WIDTH=100 HEIGHT=100 border = 0/a");elsedocument.write("EMBED src='" + ad_float_left_src + "' FlashVars='" + ad_float_left_url + "' quality=high WIDTH=80 HEIGHT=80 TYPE='application/x-shockwave-flash' id=changhongout /EMBED");document.write("/td/trtrtd width=80 height=20 align=righta href='javascript:close_float_left();void(0);' class=closefloatfont color=#0000ff size=2关闭font/a/td/tr/table/div");myload()}/script/body/html

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

右下角漂浮广告代码使用方法(一): 将以下代码以**.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)

}

(责任编辑:IT教学网)

更多