修改浮动广告的网页代码,高手HELP!!!
发布网友
发布时间:2024-10-21 22:21
我来回答
共1个回答
热心网友
时间:2024-11-24 18:13
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
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 = 340;
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 = 340;
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);
}
//这里是改两边广告图片链接的部分img src=image/10.jpg为目前广告的绝对路径,还可以给图片加上超链接
document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><img src=image/10.jpg></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><img src=image/11.jpg></a></div>");
initEcAd()
//-->
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
使用说明:代码中的src的值为页面左右两边调用的图片,改为你的图片地址即可,还能为图片加上链接,代码里默认的图片链接为http://www.butong.net,将代码中的此链接改为你需要的链接地址即可,默认图片链接点击后是在新窗口中打开,如需在原窗口中打开只需将代码中的 target=_blank去掉即可。(注:在为图片加上链接时,链接代码里不要有
</body>
</html>