document.write("
热点新闻:
"); document.getElementById('head_scroll_news').scrollTop = 0; var news_body = document.getElementById('head_scroll_news_body'); var news_div = document.getElementById('head_scroll_news'); function HEAD_SCROLL_NEWS(){ var o = this; news_div.onmouseover = function() { clearTimeout(o.scroll_timeout); o.pause = true; o.scrolling = false; o.restart(); }; news_div.onmouseout = function() { o.pause = false; o.scrolling = true; }; news_body.appendChild(news_body.childNodes[0].cloneNode(true)); }; HEAD_SCROLL_NEWS.prototype.scrolling = false; HEAD_SCROLL_NEWS.prototype.pause = false; HEAD_SCROLL_NEWS.prototype.scroll_index = 0; HEAD_SCROLL_NEWS.prototype.scroll_rule = 30; HEAD_SCROLL_NEWS.prototype.scroll_setinter = null; HEAD_SCROLL_NEWS.prototype.scroll_timeout = null; HEAD_SCROLL_NEWS.prototype.start = function() { if(this.pause) return; this.scrolling = true; this.starting(); if( (document.getElementById('head_scroll_news').scrollTop + 30) >= document.getElementById('head_scroll_news_body').offsetHeight) { document.getElementById('head_scroll_news').scrollTop = 0;}; }; HEAD_SCROLL_NEWS.prototype.starting = function() { var o = this; this.scroll_setinter = setInterval(function() { if(o.scrolling) { document.getElementById('head_scroll_news').scrollTop += 1; o.scroll_index++;}; if(o.scroll_index >= o.scroll_rule) { o.scroll_index = 0; o.scrolling = false; clearInterval(o.scroll_setinter); o.restart(); }; }, 10); }; HEAD_SCROLL_NEWS.prototype.restart = function() { var o = this; this.scroll_timeout = setTimeout(function() { o.start(); }, 2000); }; var HEAD_SCROLL_NEWS = new HEAD_SCROLL_NEWS(); HEAD_SCROLL_NEWS.start();