回 帖 发 新 帖 刷新版面

主题:如何实现对联广告的浮动效果且在后台不显示?

如何实现对联广告的浮动效果且在后台不显示?
单位网站中我加了个对联广告,但不能实现跟随窗口的浮动效果,另外如何在后台不显示,请教高手解答。
代码如下:
<SCRIPT language=JavaScript event=FSCommand() for=dl> 
duilian2.style.visibility='hidden'; 
duilian3.style.visibility='hidden'; 
</SCRIPT>

<SCRIPT language=JavaScript> 
function winload() 

duilian2.style.top=20; 
duilian2.style.left=5; 
duilian3.style.top=20; 
duilian3.style.right=5; 

if(screen.width>800){ 

document.write("<div id=duilian2 style='position: absolute;visibility:visible;z-index:1'><EMBED src='left.swf' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=dl></EMBED></div>" 
+"<div id=duilian3 style='position: absolute;visibility:visible;z-index:1'><EMBED src='right.swf' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=dl></EMBED></div>"); 

winload() ;

</SCRIPT>

回复列表 (共1个回复)

沙发

<%@ Language=VBScript%>
<!--#include file="config.asp"-->
    function closeAd(){
    duilian_left.style.visibility='hidden';
    duilian_right.style.visibility='hidden';}
   var delta=0.015
  var collection;
  function floaters() {
    this.items  = [];
    this.addItem  = function(id,x,y,content)
         {
          document.write('<DIV id='+id+' style="Z-INDEX: 0; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
          
          var newItem        = {};
          newItem.object      = document.getElementById(id);
          newItem.x        = x;
          newItem.y        = y;

          this.items[this.items.length]    = newItem;
         }
    this.play  = function()
         {
          collection        = this.items
          setInterval('play()',10);
         }
    }
    function play()
    {
      if(screen.width<=800)
      {
        for(var i=0;i<collection.length;i++)
        {
          collection[i].object.style.display  = 'none';
        }
        return;
      }
      for(var i=0;i<collection.length;i++)
      {
        var followObj    = collection[i].object;
        var followObj_x    = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
        var followObj_y    = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);

        if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
          var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
          dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
          followObj.style.left=followObj.offsetLeft+dx;
          }

        if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
          var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
          dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
          followObj.style.top=followObj.offsetTop+dy;
          }
        followObj.style.display  = '';
      }
    }  
    
  var theFloaters    = new floaters();
  theFloaters.addItem('followDiv2',0,80,'<div id=duilian_left style="position: absolute;visibility:visible;z-index:1"><table width=100  border=0 cellspacing=0 cellpadding=0><tr><td height=12 align=right bgcolor=#006600><a href=javascript:closeAd()><img src=images/close.gif width=12 height=12 border=0></a></td></tr><tr><td><a href="<%=L_MAIN%>" target=_blank><img src="<%=L_TOP%>" border=0 width="100" height="460" alt="<%=R_MAIN%>" align=top></a></td></tr></table></div>');
  theFloaters.addItem('followDiv1','document.body.clientWidth-100',80,'<div id=duilian_right style="position: absolute;visibility:visible;z-index:1"><table width=100  border=0 cellspacing=0 cellpadding=0><tr><td height=12 align=left bgcolor=#006600><a href=javascript:closeAd()><img src=images/close.gif width=12 height=12 border=0></a></td></tr><tr><td><a href="<%=L_MAIN%>" target=_blank><img src="<%=R_TOP%>" border=0 width="100" height="460" alt="<%=R_MAIN%>" align=top></a></td></tr></table></div>');
  theFloaters.play(); 

这是写在asp文件里的源码,用script引用文件,其中,你可以在你的config.asp文件中设置L_TOP和R_TOP的值,来显示相应的图片。关闭按钮的图片是images/close.gif,你也可以自己修改!

我来回复

您尚未登录,请登录后再回复。点此登录或注册