对联广告代码,支持FLASH,可浮动的对联广告代码

对联广告调用代码  <script src="js/duilian.js" language="JavaScript"></script>

 

对联广告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 = 100;// 左侧广告距离页首高度
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 = 100;// 右侧广告距离页首高度
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: absolute;visibility:hidden;z-index:1'><a href='http://www.web1388.com' target='_blank'><img src=/linux/UploadFiles_5291/201106/20110618214211216.gif border='0'></a></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.web1388.com' target='_blank'><img src=/linux/UploadFiles_5291/201106/20110618214211216.gif border='0'></a></div>");
initEcAd()

// JavaScript Document

 

 

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>随滚动条移动支持FLASH的对联广告代码</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html" charset="gb2312">
</HEAD>
<style>
<!--
*{margin:0;padding:0;}
div{float:left;}
.duilian{
 position: absolute;
 background-color: #EFEFEF;
 line-height:20px;
 font-size:12px;
 z-index:1000;
}
</style>
<BODY>

<div id="leftdiv" class="duilian" style="width:110px; height:300px;" align="center">
     <embed src="duilian.swf" type="application/x-shockwave-flash"  width="110" height="300" quality="High" wmode="transparent">
     </embed><a href="javascript: Closediv()" style="color:red;">关闭</a></div>
<SCRIPT LANGUAGE="JavaScript">
function left(){
 document.getElementById("leftdiv").style.top=document.body.scrollTop+100;//高度定位,修改数值
 document.getElementById("leftdiv").style.left=document.body.scrollLeft;
}
</SCRIPT>

<div id="rightdiv" class="duilian" style="width: 110px; height:300px;" align="center">
     <embed src="duilian.swf" type="application/x-shockwave-flash"  width="110" height="300" quality="High" wmode="transparent">
     </embed><a href="javascript: Closediv()" style="color:red;">关闭</a></div>
<SCRIPT LANGUAGE="JavaScript">
function right(){
 document.getElementById("rightdiv").style.top=document.body.scrollTop+100;//高度定位,修改数值
 document.getElementById("rightdiv").style.left=document.body.scrollLeft+document.body.clientWidth-document.getElementById("rightdiv").offsetWidth;
}
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
<!--
function scall(){
 left();right();
}
window.onscroll=scall;
window.onresize=scall;
window.onload=scall;

function Closediv()                                               
{
leftdiv.style.visibility="hidden";
rightdiv.style.visibility="hidden";
}
//-->
</SCRIPT>
<div style=" height: 4000;"></div>
</BODY>
</HTML>

 

 

对联广告三,支持xhtml1.0

 

<script language="JavaScript" type="text/javascript">
lastScrollY=0;
function heartBeat(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
 diffY = document.documentElement.scrollTop;
else if (document.body)
 diffY = document.body.scrollTop
else
    {/*Netscape stuff*/}
 
//alert(diffY);
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("lovexin12").style.top=parseInt(document.getElementById
("lovexin12").style.top)+percent+"px";
document.getElementById("lovexin14").style.top=parseInt(document.getElementById
("lovexin12").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
//alert(lastScrollY);
}
suspendcode12="<DIV id=\"lovexin12\" style='left:2px;POSITION:absolute;TOP:120px;'><a href=/upfiles/file/diliujiehuikan.zip><img src=/linux/UploadFiles_5291/201106/20110620211615266.gif /></a></div>"
suspendcode14="<DIV id=\"lovexin14\" style='right:2px;POSITION:absolute;TOP:120px;'><a href=/upfiles/file/diliujiehuikan.zip><img src=/linux/UploadFiles_5291/201106/20110620211615266.gif /></a></div>"
document.write(suspendcode12);
document.write(suspendcode14);
window.setInterval("heartBeat()",1);
</script>
<style type="text/css">
<!--
#lovexin12,#lovexin14{
   width:100px;
   height:230px;
   background-color:#e5e5e5;
   border:1px solid #ddd;
}

-->
</style>

 

  网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)