某网站滚动新闻源码

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta http-equiv="refresh content=600" content="text/html" />
<style type="text/css">
div
{
 font-size: 12px
}
body
{
 font-size: 12px
}
.a {
 font-size: 12px
}
A:link
{
 color: #000080; text-decoration: none
}
A:visited
{
 color: #0000ff; text-decoration: none
}
A:active
{
 color: #0000ff; text-decoration: none
}
A:hover
{
 color: #0000ff; text-decoration: underline
}
</style>
<meta content="MSHTML 6.00.3790.4106" name="GENERATOR"/>
</head>
<body οnmοusedοwn="tracking(event);" style="margin-left:0px;margin-right:0px;margin-top:0px;">

<div id="main" style="overflow: hidden">
<div style="white-space: nowrap">
<div id="first" οnmοuseοver="stopit(true)" style="left: 0px; position: absolute;
top: 1px" οnmοuseοut="stopit(false,first_obj)">
</div>
<div id="second" οnmοuseοver="stopit(true)" style="left: 0px; position: absolute"
οnmοuseοut="stopit(false,second_obj)">
</div>
</div>
</div>

<script type="text/javascript">
var scrollerdelay='5000'
var scrollerwidth='100%'
var scrollerheight='15px'
var scrollerbgcolor='#fff'
var messages=new Array()
messages[0]='<a href="http://news.xinhuanet.com/legal/2007-08/17/content_6549223.htm" target="_blank">新疆喀什地区清理出干部拖欠公款4300多万元</a>'
messages[1]='<a href="http://news.xinhuanet.com/legal/2007-08/17/content_6549218.htm" target="_blank">盗窃兰花价值640万元 两被告判无期</a>'
messages[2]='<a href="http://news.xinhuanet.com/legal/2007-08/17/content_6549196.htm" target="_blank">2学生自杀 4同学出庭指证老师打人</a>'
messages[3]='<a href="http://news.xinhuanet.com/newscenter/2007-08/17/content_6549180.htm" target="_blank">厄瓜多尔呼吁安共体和南共市国家加强合作 </a>'
messages[4]='<a href="http://news.xinhuanet.com/newscenter/2007-08/17/content_6549164.htm" target="_blank">纽约股市大幅震荡 道琼斯30种股票均价值数暴跌</a>'
messages[5]='<a href="http://news.xinhuanet.com/newscenter/2007-08/17/content_6549136.htm" target="_blank">美国一恐怖嫌疑人被判有罪 将面临终身监禁</a>'
messages[6]='<a href="http://news.xinhuanet.com/legal/2007-08/17/content_6549124.htm" target="_blank">儿子撞死人父亲来顶罪 均被判刑</a>'
messages[7]='<a href="http://news.xinhuanet.com/tech/2007-08/17/content_6549117.htm" target="_blank">通宵吃喝浑然不知 夜间拍摄揭开梦食真相</a>'
var ie=document.all
var dom=document.getElementById
var stopscroll=false
var t1=""
var t2=""
if (messages.length>2)
i=2
else
i=0
function move(whichdiv){
if(stopscroll==true) return
tdiv=eval(whichdiv)
if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5) return waitscroll(tdiv)
if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
setTimeout("move(tdiv)",50)
}
else{
tdiv.style.top=parseInt(scrollerheight)+"px"
tdiv.innerHTML=messages[i]
if (i==messages.length-1)
i=0
else
i++
}
}
function move2(whichdiv){
if(stopscroll==true) return
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5) return waitscroll(tdiv2)
if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
setTimeout("move2(second_obj)",50)
}
else{
tdiv2.style.top=parseInt(scrollerheight)+"px"
tdiv2.innerHTML=messages[i]
if (i==messages.length-1)
i=0
else
i++
}
}
function startscroll(){
first_obj=ie? first : document.getElementById("first")
second_obj=ie? second : document.getElementById("second")
main_obj=ie? main : document.getElementById("main")
move(first_obj)
second_obj.style.top=scrollerheight
second_obj.style.visibility='visible'
if (ie||dom){
main_obj.style.width=scrollerwidth
main_obj.style.height=scrollerheight
main_obj.style.bgcolor=scrollerbgcolor
first_obj.innerHTML=messages[0];
first_obj.style.width=scrollerwidth
first_obj.style.height=scrollerheight;
second_obj.innerHTML=messages[dyndetermine=(messages.length==1)? 0 : 1];
second_obj.style.width=scrollerwidth
second_obj.style.height=scrollerheight;
}
}
if (window.addEventListener)
window.addEventListener("load", startscroll, false)
else if (window.attachEvent)
window.attachEvent("onload", startscroll)
else if (ie||dom)
window.οnlοad=startscroll
function stopit(isstop,dname){
stopscroll=isstop
if (isstop==false) {
clearTimeout(t1)
clearTimeout(t2)
waitscroll(dname,"y")
}
}
function waitscroll(dname,fs){
if (fs==null) dname.style.top=0+"px"
t1=setTimeout("move(first_obj)",scrollerdelay)
t2=setTimeout("move2(second_obj)",scrollerdelay)
return
}
function tracking(e){
 e = e ? e : window.event;
 var s = e.srcElement ? e.srcElement : e.target;
 var a = s.tagName;
 var u = s.href;
 var t = s.innerText ? s.innerText : s.textContent;
 if(a == "A" || a == "IMG"){
  if(a == "IMG"){
   t = s.href || s.src;
   u = s.parentElement || s.parentNode;
  }
  try{
   new Image().src = "http://statis.265.com/url?a="+a+"&u="+escape(u)+"&t="+t;
  }catch(ex){}
 }
 return true;
}
</script>

</body>
</html>
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值