<SCRIPT FOR=window EVENT=onload LANGUAGE="javascript">
initAd();//载入页面后,调用函数initAd()
</SCRIPT>
<script language="javascript">
<!--
function initAd() {
document.all.AdLayer.style.posTop = -200;
//设置onLoad事件激发以后,广告层相对于固定后的y方向位置
document.all.AdLayer.style.visibility = 'visible'//设置层为可见
MoveLayer('AdLayer');//调用函数MoveLayer()
}
function MoveLayer(layerName) {
var x = 0;//浮动广告层固定于浏览器的x方向位置
var y = 300;//浮动广告层固定于浏览器的y方向位置
var diff = (document.body.scrollTop + y - document.all.AdLayer.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("MoveLayer('AdLayer');", 0);//设置20毫秒后再调用函数MoveLayer()
}
//-->
</script>
<!--下面为一个ID为AdLayer的层(如ID名不为AdLayer,
上面MoveLayer()内的AdLayer也要作相应修改),包括一张带链接的图片-->
<div id=AdLayer style='position:absolute; width:200px; height:59px; z-index:20; visibility:hidden;; right: 10px; top: 100px'>
<b>本人文学网站开通,欢迎大家赏脸光顾</b><br/>
<a href="http://story.518east.com/Book/Detail/2009/09/01/24152.html" target="_blank">
<img src="http://story.518east.com/images/logo.jpg" border="0">
</a></div>
漂浮广告代码
<div id="www_qpsh_com" style="position:absolute">
<b>本人文学网站开通,欢迎大家赏脸光顾</b>
<a href="http://story.518east.com/Book/Detail/2009/09/01/24152.html" target="_blank">
<img src="http://img03.518east.com/Story/2009911621301984.jpg" 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("www_qpsh_com")
function floatwww_qpsh_com() {
var L=T=0
//by www.qpsh.com
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("floatwww_qpsh_com()", delay)
obj.onmouseover=function(){clearInterval(itl)}
obj.onmouseout=function(){itl=setInterval("floatwww_qpsh_com()", delay)}
</script>