读书人

循环滚动绑定数据,该怎么解决

发布时间: 2012-04-24 14:15:38 作者: rapoo

循环滚动绑定数据
我想实现 <ol id="roll">里面的代码不仅可以绑定数据库 而且可以循环滚动 请大家给只个招 用什么方法可以搞定啊
前台代码:
<ol id="roll">
<li> <a title="学校动态" target="_blank" href="StudentLogin.aspx"> 学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/tcys/1060.htm">
学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/tcys/1059.htm">
学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/tcys/1058.htm">
学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/tcys/1057.htm">
学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/ljwb/1056.htm">
学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/ljwb/1055.htm">
学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/qtdm/1054.htm">
学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/txtx/1036.htm">
学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/txtx/1035.htm">
学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/cddh/1034.htm">
学校动态</a></li>
<li> <a title="学校动态" target="_blank" href="http://www.csrcode.cn/html/txdm/ljwb/1032.htm">
学校动态</a></li>
</ol>


<script type="text/javascript">
(function(A){
function _ROLL(obj){
this.ele = document.getElementById(obj);
this.interval = false;
this.currentNode = 0;
this.passNode = 0;
this.speed = 100;
this.childs = _childs(this.ele);
this.childHeight = parseInt(_style(this.childs[0])['height']);
addEvent(this.ele,'mouseover',function(){
window._loveYR.pause();
});
addEvent(this.ele,'mouseout',function(){
window._loveYR.start(_loveYR.speed);
});
}
function _style(obj){
return obj.currentStyle || document.defaultView.getComputedStyle(obj,null);
}
function _childs(obj){
var childs = [];
for(var i=0;i<obj.childNodes.length;i++){
var _this = obj.childNodes[i];
if(_this.nodeType===1){
childs.push(_this);
}
}
return childs;
}
function addEvent(elem,evt,func){
if(-[1,]){
elem.addEventListener(evt,func,false);
}else{
elem.attachEvent('on'+evt,func);
};
}


function innerest(elem){
var c = elem;
while(c.childNodes.item(0).nodeType==1){
c = c.childNodes.item(0);
}
return c;
}
_ROLL.prototype = {
start:function(s){
var _this = this;
_this.speed = s || 100;
_this.interval = setInterval(function(){
_this.ele.scrollTop += 1;
_this.passNode++;
if(_this.passNode%_this.childHeight==0){
var o = _this.childs[_this.currentNode] || _this.childs[0];
_this.currentNode<(_this.childs.length-1)?_this.currentNode++:_this.currentNode=0;
_this.passNode = 0;
_this.ele.scrollTop = 0;
_this.ele.appendChild(o);
}
},_this.speed);
},
pause:function(){
var _this = this;
clearInterval(_this.interval);
}
}
A.marqueen = function(obj){A._loveYR = new _ROLL(obj); return A._loveYR;}
})(window);
marqueen('roll').start(80/*默认速度100*/);
</script>

[解决办法]

HTML code
<marquee scrollamount="2" width="150" height="200" direction="up" onmouseover="stop()"        onmouseout="start()">    <div id="div1" runat="server">    </div>    </marquee>
[解决办法]
探讨
HTML code


<marquee scrollamount="2" width="150" height="200" direction="up" onmouseover="stop()"
onmouseout="start()">
<div id="div1" runat="server">

</div>
</marquee>
……

[解决办法]
JScript code
/*无间隙滚动信息*/function ScrollImgLeft(){var speed=30var scroll_begin = document.getElementById("scroll_begin");var scroll_end = document.getElementById("scroll_end");var scroll_div = document.getElementById("scroll_div");scroll_end.innerHTML=scroll_begin.innerHTMLfunction Marquee(){    if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)      scroll_div.scrollLeft -= scroll_begin.offsetWidth    else      scroll_div.scrollLeft++}var MyMar=setInterval(Marquee,speed)scroll_div.onmouseover=function() {clearInterval(MyMar)}scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)}}</script>
[解决办法]
http://www.popub.net/script/msclass.html

读书人网 >asp.net

热点推荐