googleada.js

来自「程序中带有大量的实例,采用多种方式优化代码,这初学者很好的学习资料」· JavaScript 代码 · 共 26 行

JS
26
字号
function initAd() {//cxssdiv为google广告层//online为在线咨询层cxssdiv.style.visibility = 'visible' //设置层为可见cxssdiv.style.posTop = -100; //设置onLoad事件激发以后,广告层相对于固定后的y方向位置//------------------在线咨询--------------------------------------online.style.visibility = 'visible'online.style.posTop = -100;MoveLayer(); //调用函数MoveLayer()}function MoveLayer() {var x = 2 //浮动广告层固定于浏览器的x方向位置var y = 200; //浮动广告层固定于浏览器的y方向位置var diff = (document.documentElement.scrollTop + y - cxssdiv.style.posTop)*.40;var y = document.documentElement.scrollTop + y - diff;cxssdiv.style.posTop = y;cxssdiv.style.posLeft = x; //移动广告层//-------------------------在线咨询---------------------------------var ox = 880online.style.posTop =y;online.style.posLeft = ox; //移动广告层setTimeout("javascript:MoveLayer()", 20); //设置20毫秒后再调用函数MoveLayer()}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?