日期:2014-05-20  浏览次数:20512 次

将数据读取到DataGrid里。如何实现让数据自动滚动
将数据读取到DataGrid里。如何实现让数据自动滚动
(并且每隔3秒停一次,然后在接着滚动)
说是用Javascript
查了半天也没查到··
拜托了

------解决方案--------------------
我这有个代码javascript的,如下:
<head>
<script language=javascript>
<!--
var rollspeed = 30;
var myInter;
function StartRoll(direction) {
if (direction == 'V ') {
StartRollV();
} else {
StartRollH();
}
}
function MarqueeV()
{
var ooRoll = document.getElementById( "oRoll ");
var ooRoll1 = document.getElementById( "oRoll1 ");
var ooRoll2 = document.getElementById( "oRoll2 ");
if(ooRoll2.offsetTop - ooRoll.scrollTop <= 0)
{
ooRoll.scrollTop -= ooRoll1.offsetHeight;
}
else
{
ooRoll.scrollTop++;
}
}
function StartRollV()
{
var ooRoll = document.getElementById( "oRoll ");
var ooRoll1 = document.getElementById( "oRoll1 ");
var ooRoll2 = document.getElementById( "oRoll2 ");
if (ooRoll) {
if (parseInt(ooRoll.style.height) > = ooRoll2.offsetTop)
{
ooRoll.style.height = ooRoll2.offsetTop;
return;
}
ooRoll2.innerHTML = ooRoll1.innerHTML;
myInter = setInterval(MarqueeV,rollspeed);
ooRoll.onmouseover = function() {
clearInterval(myInter)
};
ooRoll.onmouseout = function() {
myInter = setInterval(MarqueeV,rollspeed)
};
}
}
// -->
</script>
</head>

<body onload= "StartRoll( 'V ') "> ........

<DIV id=oRoll>
<DIV id=oRoll1> 这里放你的DataGrid </DIV>
<DIV id=oRoll2> <!-- Copy oRoll1 --> </DIV>
</DIV>

</body>