怎样在织梦dedecms网站上添加漂浮广告

html-css08

怎样在织梦dedecms网站上添加漂浮广告,第1张

漂浮广告用如下代码:

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>js实现可关闭的自由漂浮广告代码_js特效_特效代码_www.xunmzy.com</title>

<meta http-equiv="content-type" content="text/htmlcharset=utf-8">

<style type="text/css">

#img1{width:autoposition:absolutetop:43pxleft:2pxz-index:10}

#img1 div{width:autotext-align:rightfont-size:12px}

#img1 div a:link{text-decoration:none}

#img1 div a:hover{color:redtext-decoration:none}

#img1 img{width:autoborder:1px solid black}

p{margin-top:50pxtext-align:center}

</style>

</head>

<body>

<div id="img1" onmouseover="pause_resume()" onmouseout="pause_resume()">

<div><a href="javascript:void(0)" onclick="closediv()" title="点击关闭">关闭</a></div>

<a href="https://www.xunmzy.com/" target="_blank"><img src="images/logo_png.png" alt="js实现可关闭的自由漂浮广告代码"></a>

</div>

<p>js代码可关闭的自由漂浮的图片广告特效</p>

<script type="text/javascript">

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

var divid = img1 //浮动DIV的ID.

divid.style.top = yPos

function changePos(){

   width = document.body.clientWidth

   height = document.body.clientHeight

   Hoffset = divid.offsetHeight

   Woffset = divid.offsetWidth

   divid.style.left = xPos + document.body.scrollLeft

   divid.style.top = yPos + document.body.scrollTop

   if(yon){yPos = yPos + step}else{yPos = yPos - step}

   if(yPos < 0){yon = 1yPos = 0}

   if(yPos >= (height - Hoffset)){yon = 0 yPos = (height - Hoffset)}

   if(xon){xPos = xPos + step}else{xPos = xPos - step}

   if(xPos < 0){xon = 1xPos = 0}

   if(xPos >= (width - Woffset)){xon = 0 xPos = (width - Woffset)}

}

function start(){

   divid.visibility = "visible"

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

}

function pause_resume(){

   if(pause){

   clearInterval(interval)

   pause = false}

   else{

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

   pause = true 

   }

}

function closediv(){

   clearInterval(interval)

   divid.style.display = "none"

}

start()

</script>

</body>

</html>

把需要改的地方改了就可以了,

<html><head><title>固定在底部的漂浮广告</title></head><body><script 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.width>800 ? imgheight_close=120:imgheight_close=120window.screen.width>800 ? imgleft=15:imgleft=122function myload(){myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight_closemyleft.style.left=imgleftleftmove()}function leftmove(){myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight_closemyleft.style.left=imgleftsetTimeout("leftmove()",50)}function MM_reloadPage(init) {if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {document.MM_pgW=innerWidthdocument.MM_pgH=innerHeightonresize=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: absolutewidth:80top:300left:5visibility: visiblez-index: 1'><style>A.closefloat:link,A.refloat:visited {text-decoration:nonecolor:#000000font-size:12px}A.closefloat:active,A.refloat:hover {text-decoration:underlinecolor:#0000FFfont-size:12px}</style><table border=0 cellpadding=0 cellspacing=0><tr><td>")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></tr><tr><td width=80 height=20 align=right><a href='javascript:close_float_left()void(0)' class=closefloat><font color=#0000ff size=2>关闭<font></a></td></tr></table></div>")myload()}</script></body></html>

加入下面的代码,位置可以修改一下参数

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />

<title>

悬浮广告

</title>

</head>

<body>

<div style="height:900pxdisplay:block"></div>

<div

id="AdLayer1"

style='position:

absolute

z-index:1

left:100px

border:1px

#DDD

solid

width:36pxheight:200pxbackground-color:#CCC'></div>

<div

id="AdLayer2"

style='position:

absolute

z-index:1

right:100px

border:1px

#DDD

solid

width:36pxheight:200pxbackground-color:green'></div>

<script type="text/javascript">

//

页面初始化

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 = 100

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 = 100

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)

}

initEcAd()