日期:2014-05-16 浏览次数:20507 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <body> <SCRIPT LANGUAGE="JavaScript"> function initEcAd() { document.all.AdLayer1.style.posTop = -200;//设置onLoad事件激发以后,广告层相对于固定后的y方向位置 document.all.AdLayer1.style.visibility = 'visible'//设置层为可见 MoveLayer1('AdLayer1');//调用函数MoveLayer() } function MoveLayer1(layerName) { var x = 5;//浮动广告层固定于浏览器的x方向位置 var y =document.documentElement .clientHeight/2-25;//浮动广告层固定于浏览器的y方向位置 var diff = (document.documentElement .scrollTop + y - document.all.AdLayer1.style.posTop)*.40; var y = document.documentElement .scrollTop + y - diff; eval("document.all." + layerName + ".style.posTop = y"); eval("document.all." + layerName + ".style.posLeft = x");//移动广告层 setTimeout("MoveLayer1('AdLayer1');", 20);//设置20毫秒后再调用函数MoveLayer1() } document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><img src=http://img.baidu.com/img/logo-zhidao.gif></div>"); initEcAd() </SCRIPT> </body> </html>