个人站长制做网页常用代码集锦(三)
点击次数:22 次 发布日期:2008-11-26 20:18:21 作者:源代码网
|
源代码网推荐<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 = 360;//浮动广告层固定于浏览器的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:61px; height:59px; z-index:20; visibility:hidden;; right: 10px; top: 100px"> 源代码网推荐<a href="addxinxi.asp"><img border="0" src="http://www.zzchn.com/edu/20071025/images/fb.jpg" width="100" height="40"></a></div> 源代码网供稿. |
