日期:2014-05-17  浏览次数:20507 次

诡异的js对联广告
先上代码
function initEcAd() {
document.all.AdLayer1.style.posTop = 100;
document.all.AdLayer1.style.visibility = 'visible'
MoveLeftLayer('AdLayer1');
}
function MoveLeftLayer(layerName) {
var x = 5;
var y = 150;// 左侧广告距离页首高度
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);
}
document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.khimmigration.com/Hungary.htm' target='_blank'><img src=images/ad-01.gif border='0'></a><br><a href=# onclick=\"AdLayer1.style.display='none'\">关闭</a></div>");
initEcAd()

// JavaScript Document


找了这么个js左侧对联的广告,问题是下面的关闭区域不显示啊,问题是ie里面他根本挤不动啊!
求搭救,或者干脆给我个代码我换掉它

------解决方案--------------------
http://ad.jz123.cn/
------解决方案--------------------
用jQuery改写的版本
var adinterval;
jQuery(document).ready(function(){

var suspendcode="<DIV id=lovexin1 style='Z-INDEX: 10; LEFT: 6px; POSITION: absolute; TOP: 105px; width: 100; height: 300px;background-color:#FFFFFF;'><img src='/sysImages/ad/close.gif' onClick='javascript:adhide()' width='100' height='14' border='0' vspace='3' alt='关闭对联广告'><br/><a href#' target='_blank'><img src='/sysImages/ad/1.jpg' width='100' height='300' border='0'></a></DIV>"
jQuery("body").append(suspendcode);

suspendcode="<DIV id=lovexin2 style='Z-INDEX: 10; right: 6px; POSITION: absolute; TOP: 105px; width: 100; height: 300px;background-color:#FFFFFF;'><img src='/sysImages/ad/close.gif' onClick='javascript:adhide()' width='100' height='14' border='0' vspace='3' alt='关闭对联广告'><br/><a href='#' target='_blank'><img src='/sysImages/ad/2.jpg' width='100' height='300' border='0'></a></DIV>"
jQuery("body").append(suspendcode);

//flash格式调用方法
//<EMBED src='flash.swf' quality=high  WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=ad wmode=opaque></EMBED>

   adinterval=setInterval("heartBeat()",1);
});
var lastScrollY=0;
function heartBeat(){
var diffY=jQuery(document).scrollTop();
var percent=.3*(diffY-lastScrollY);
if(percent>0){
percent=Math.ceil(percent);
}
else{
percent=Math.floor(percent);
}
//alert(jQuery("#lovexin1").css("top"));
jQuery("#lovexin1").css("top",parseInt(jQuery("#lovexin1").css("top"))&nb