符合W3C协议的对联广告

 

下面的JS文件:

function    $(id)   
return   document.getElementById(id); 
}
 

function    scrollBanner(timer,   moveNumber)   

function   move(o)   
var   st   =   document.documentElement.scrollTop   +   o.t; 
var   sl   =   document.documentElement.scrollLeft   +   (o.c   ==   0   ?   o.a   :   document.documentElement.clientWidth   -   o.a   -   o.offsetWidth); 
var   tc   =   st   -   o.offsetTop,   lc   =   sl   -   o.offsetLeft; 
with   (o.style)   
top   
=   o.offsetTop   +   (tc   !=   0   ?   tc   /   Math.abs(tc)   :   0)   *   Math.min(Math.abs(tc),   moveNumber)   +   "px"
left   
=   o.offsetLeft   +   (lc   !=   0   ?   lc   /   Math.abs(lc)   :   0)   *   Math.min(Math.abs(lc),   moveNumber)   +   "px"
}
 
if   (o.person)   
with   (o.person.style)   
top   
=   o.offsetTop   +   "px"
left   
=   o.offsetLeft   +   o.offsetWidth   -   o.person.offsetWidth   +   "px"
}
 
}
 
}
 

var   hidden   =   function()   
var   o   =   this.parent; 
window.clearInterval(o.interval); 
o.parentNode.removeChild(o); 
this.parentNode.removeChild(this); 
}
 

this.add   =   function   (to,   t,   a,   c,   lo)   
/* 
to为object对象 
t为距离顶端距离 
当c   =   0的时候,a为距离左边的距离 
当c   !=   0的时候,a为距离右边的距离 
lo为关闭按钮 
*/
 
var   div,   exec   =   function   ()   
move(to); 
}


to.person   
=   lo; 
to.t   
=   t; 
to.a   
=   a; 
to.c   
=   c; 
with   (to.style)   
position   
=   "absolute"
display   
=   "block"
top   
=   document.documentElement.scrollTop   +   t; 
left   
=   document.documentElement.scrollLeft   +   (c   ==   0   ?   a   :   document.documentElement.clientWidth   -   a   -   to.offsetWidth); 
}
 

if   ("undefined"   !=   typeof   lo)   
with   (lo.style)   
position   
=   "absolute"
display   
=   "block"
}
 
lo.onmousedown   
=   hidden; 
lo.parent   
=   to; 
}
 
exec(); 
to.interval   
=   window.setInterval(exec,   timer); 
}

}
 

window.onload   
=     function    ()   
var   b   =   new   scrollBanner(10,15); 
b.add($(
"lwc"),   80,   10,   0,   $("lwc_c")); 

b.add($(
"rwc"),   80,   10,   1,   $("rwc_c")); 

b   
=   null
}

 下面是页面的调用:

 

< div id = " lwc "   runat = " server " >< a href = " # "  target = " _blank " >< img src = " duilianguanggaowei1.jpg "  width = " 97 "  height = " 240 "  border = " 0 "   /></ a ></ div  >
< div id = " rwc "   runat = " server " >< a href = " # "  target = " _blank " >< img src = " duilianguanggaowei1.jpg "  width = " 97 "  height = " 240 "  border = " 0 "   /></ a ></ div  >  
< input  class = " close "  id = " lwc_c "   runat = " server "  type = " text "  value = " ¤关闭 "  style = " width: 40px; height: 15px; background-color: transparent; "   />< input  class = " close "   id = " rwc_c "   runat = " server "   type = " text "  value = " ¤关闭 "  style = " width: 40px; height: 15px; background-color: transparent; background-image: none; "   />  
< asp:Label ID = " Label1 "  runat = " server " ></ asp:Label >
< asp:Button ID = " Button1 "  runat = " server "  Text = " 不显示 "  OnClick = " Button1_Click "   />
< asp:Button ID = " Button3 "  runat = " server "  OnClick = " Button3_Click "  Text = " 显示 "   />

 

还有CSS文件:

 

#lwc,   #rwc    { 
width
:97px; 
height
:240px; 
background
:#009999;
}

#lwca,   #rwca   
{ 
width
:97px; 
height
:97px; 
background
:#009999;
}

.close
{
    height
: 13px;
    width
: 13px;
    border-top-style
: none;
    border-right-style
: none;
    border-bottom-style
: none;
    border-left-style
: none;
    background-repeat
: no-repeat;
    margin-top
: 2px;
    margin-right
: 2px;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值