如何优化这段广告代码?
function close_float_left(){ AdLayer1.style.visibility="hidden"; } function close_float_right(){ AdLayer2.style.visibility="hidden"; }

<br> &lt;!--<br> //more javascript from <a href="http://www.smallrain.net">http://www.smallrain.net</a><br> function initEcAd() {<br> document.all.AdLayer1.style.posTop =30;<br> document.all.AdLayer1.style.visibility = &#39;visible&#39;<br> document.all.AdLayer2.style.posTop =30;<br> document.all.AdLayer2.style.visibility = &#39;visible&#39;<br> MoveLeftLayer(&#39;AdLayer1&#39;);<br> MoveRightLayer(&#39;AdLayer2&#39;);<br> }<br> function MoveLeftLayer(layerName) {<br> var x = 5;<br> var y = 130;<br> var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;<br> var y = document.body.scrollTop + y - diff;<br> eval(&quot;document.all.&quot; + layerName + &quot;.style.posTop = parseInt(y)&quot;);<br> eval(&quot;document.all.&quot; + layerName + &quot;.style.posLeft = x&quot;);<br> setTimeout(&quot;MoveLeftLayer(&#39;AdLayer1&#39;);&quot;, 20);<br> }<br> function MoveRightLayer(layerName) {<br> var x = 5;<br> var y = 130;<br> var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;<br> var y = document.body.scrollTop + y - diff;<br> eval(&quot;document.all.&quot; + layerName + &quot;.style.posTop = y&quot;);<br> eval(&quot;document.all.&quot; + layerName + &quot;.style.posRight = x&quot;);<br> setTimeout(&quot;MoveRightLayer(&#39;AdLayer2&#39;);&quot;, 120);<br> }</p> <p>请问这段广告代码应该如何优化呢?<br> eval(&quot;document.all.&quot; + layerName + &quot;.style.posTop = y&quot;);<br> eval(&quot;document.all.&quot; + layerName + &quot;.style.posRight = x&quot;);<br> 尤其是这两句代码?非常感谢。</p>

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问