两边漂浮图片的一段JS

    技术2022-05-11  96

    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 = 0; var y = 95; 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 = y"); eval("document.all." + layerName + ".style.posLeft = x"); setTimeout("MoveLeftLayer('AdLayer1');", 20); } function MoveRightLayer(layerName) { var x = 0; var y = 95; 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'><EMBED src='/web/images/100x300.swf' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=addouble></EMBED></a></div>" //           +"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><EMBED src='/web/images/100x300.swf' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=addouble></EMBED></div>"); //initEcAd()

    var left_img='<a href=/web/agent_new.shtml><img src="/web/images/zhaoshang1.gif" border=0 id=addouble></a>'//如果是FLASH 则为//var left_img='<EMBED src="/web/images/100x300.swf" quality=high WIDTH=100 HEIGHT=300 TYPE="application/x-shockwave-flash" id=addouble></EMBED>'var right_img='<a href=/web/agent_new.shtml><img src="/web/images/zhaoshang2.gif" border=0></a>';//var right_img='<EMBED src="/web/images/100x300.swf" quality=high WIDTH=100 HEIGHT=300 TYPE="application/x-shockwave-flash" id=addouble></EMBED>'

    //document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><a href=/web/agent_new.shtml><img src='/web/images/zhaoshang1.gif' border=0></a></div>"// +"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><a href=/web/agent_new.shtml><img src='/web/images/zhaoshang1.gif' border=0></a></div>");//initEcAd()document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'>"+left_img+"</div>" +"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'>"+right_img+"</div>");initEcAd()

    //经过测试有效,适合挂图片和FLASH

     

     

    最新回复(0)