Js对联广告代码 怎么用

JavaScript025

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

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>

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

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

src="显示图片地址">

<html>

<head>

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

<style type="text/css">

    #ad1,#ad2{

        -webkit-transition: all .5s ease-out

        -moz-transition: all .5s ease-out

        -o-transition: all .5s ease-out

        transition: all .5s ease-out

        POSITION:absolute

        TOP:120px

        width:100px

        height:200px

        border:1px solid red

}

</style>

</head>

<body>

<div id="mm" style="height:2000pxbackground:#f5f5f5width:500px">

</div>

<DIV id="ad1" style='left:2px'>ad1</div>

<DIV id="ad2" style='right:2px'>ad2</div>

<script language="JavaScript" type="text/javascript">

document.onscroll=function(){

    document.getElementById("ad1").style.top=document.body.scrollTop+120+'px'

    document.getElementById("ad2").style.top=document.body.scrollTop+120+'px'

}

</script>

</body>

</html>