JS对联广告代码怎么用

JavaScript06

JS对联广告代码怎么用,第1张

把上面的js代码直接放到你网站页面中他这里的对联显示的是ad1和ad2

你要是想显示层图片就直接ad1和ad2去掉放上<img

src="显示图片地址">

js代码直接放到你网站页面中他这里的对联显示的是ad1和ad2

你要是想显示层图片就直接ad1和ad2去掉放上<img src="显示图片地址">

<html>

<head>

<title>对联广告</title>

</head>

<script language="javascript">

function yidong()

{

var abc = document.getElementById("leftdiv")

var ab = document.getElementById("rightdiv")

abc.style.top = document.body.scrollTop

ab.style.top = document.body.scrollTop

setTimeout("yidong()",6)

}

</script>

<body onload="yidong()">

<div style="height:1600px">内容显示层</div>

<div id="leftdiv" style="position:absolutez-index:1left:10px" >

<img src="广告图片地址"></div>

<div id="rightdiv" style="position:absoluteright:10pxz-index:1">

<img src="广告图片地址"></div>

</body>

</html>

<script>

var class_name=function()

{

this.top=500//与顶部距离

//左侧广告

this.l_width=100//宽

this.l_height=100//高

this.l_left=100//与左侧的距离

this.l_src="http://img.baidu.com/img/logo-zhidao.gif"//图片路径

this.l_url="http://www.baidu.com/"//图片链接地址

//右侧广告

this.r_width=100//宽

this.r_height=100//高

this.r_right=100//与右侧的距离

this.r_src="http://img.baidu.com/img/logo-zhidao.gif"//图片路径

this.r_url="http://www.baidu.com/"//图片链接地址

}

var c=new class_name()

document.write('<div id="xf_left_gg" style="position:absolutewidth:'+c.l_width+'pxheigth:'+c.l_height+'pxleft:'+c.l_left+'pxtop:'+c.top+'px"><a href="'+c.l_url+'" target="_blank"><img src="'+c.l_src+'" width="'+c.l_width+'" height="'+c.l_height+'" border="0"></a></div>')

document.write('<div id="xf_right_gg" style="position:absolutewidth:'+c.r_width+'pxheigth:'+c.r_height+'px" right:'+c.r_right+'pxtop:'+c.top+'px"><a href="'+c.l_url+'" target="_blank"><img src="'+c.l_src+'" width="'+c.l_width+'" height="'+c.l_height+'" border="0"></a></div>')

function lxs_xf()

{

var t=(document.body.scrollTop>0)?(parseInt(document.body.scrollTop)+c.top):c.top

$("xf_left_gg").style.left=c.l_left+"px"

$("xf_left_gg").style.top=t+"px"

$("xf_right_gg").style.right=c.r_right+"px"

$("xf_right_gg").style.top=t+"px"

}

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

if(window.attachEvent)

{

window.attachEvent("onload",lxs_xf)

window.attachEvent("onscroll",lxs_xf)

}

else

{

window.addEventListener("load",lxs_xf,false)

window.addEventListener("scroll",lxs_xf,false)

}

</script>