和朋友们分享一个网页对联广告代码,希望大家能用得上。
用记事本新建一个JS文件(duilian.js),把以下代码复制到文件中:
function initEcAd() {
document.all.AdLayer1.style.posTop = -200;
document.all.AdLayer1.style.visibility = 'visible'
document.all.AdLayer2.style.posTop = -200;
document.all.AdLayer2.style.visibility = 'visible'
MoveLeftLayer('AdLayer1');
MoveRightLayer('AdLayer2');
}
function MoveLeftLayer(layerName) {
var x = 5;
var y = 400;// 左侧广告距离页首高度
var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = parseInt(y)");
eval("document.all." + layerName + ".style.posLeft = x");
setTimeout("MoveLeftLayer('AdLayer1');", 20);
}
function MoveRightLayer(layerName) {
var x = 5;
var y = 400;// 右侧广告距离页首高度
var diff = (document.body.scrollTop + y - document.all.AdLayer2.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("MoveRightLayer('AdLayer2');", 20);
}
document.write("<div id=AdLayer1 style='position: fixed;visibility:hidden;z-index:1'><a href='/plus/list.php?tid=7' target='_blank'><img src='/upfiles/advs/advs100x300dzjy.gif' border='0'></a></div>"
+"<div id=AdLayer2 style='position: fixed;visibility:hidden;z-index:1'><a href='/plus/list.php?tid=7' target='_blank'><img src='/upfiles/advs/advs100x300dzjy.gif' border='0'></a></div>");
initEcAd()
// JavaScript Document
|
调用代码:
<script src="/upfiles/advs/duilian.js" type="text/javascript" language="JavaScript"></script> |
图片地址和链接可以自行修改。
需要看演示的朋友请点击 http://dzjy.85818.net
免责声明:本文由
静落凝封整理发布,版权归原作者所有,转载请注明出处,如有侵权请
联系管理员删除