求一个js对联图片悬浮随滚动条滚动代码,左右两边的图片不一样的 可改的!知道的说下 急用!

JavaScript020

求一个js对联图片悬浮随滚动条滚动代码,左右两边的图片不一样的 可改的!知道的说下 急用!,第1张

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

<html>

<head>

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

<title>带关闭按钮的网页漂浮广告代码webjx.com</title>

<style type="text/css">

<!--

.STYLE1 {font-size: 12px}

-->

</style>

</head>

<body>

<div id="img" style="position: absoluteleft: 200top: 200visibility :hidden" onMouseOver="clearInterval(interval)" onMouseOut="interval = setInterval('changePos()', delay)" align="right">

<p>公告</p>

<br/>

<span class="STYLE1" style="CURSOR:handfont-weight:bold" onClick="clearInterval(interval)img.style.visibility = 'hidden'">关闭</span></div>

<p id=em>hhh</p>

<script language=javascript>

setInterval(function(){

d1=document

d=d1.body

e=img.style

e.left=d.scrollLeft+d.clientWidth-60

e.top=d.scrollTop+d.clientHeight-100

e.visibility=''

},1)

</script>

</body>

</html>