<script Language="JavaScript"> //声明变量 var LayerTopPixel; //层首位置 var LayerOffsetHeight; //层总高度 var LayerScrollDelay; //每次滚动延迟时间,毫秒 var LayerScrollPixel; //每次滚动的象素值 var idd_up; //向前滚动计时器 var idd_down; //往后滚动计时器 var idd_Stop; //停留时间计时器 var LayerHeight; //层显示部分的高度 var LayerStopTime; //显示一屏后停留时间,毫秒 var LayerStopStatus; //停并状态标识,1:停屏,0:滚动 var LayerShowLines; //每屏显示的行数
要不把你的程序贴出来,看看
//声明变量
var LayerTopPixel; //层首位置
var LayerOffsetHeight; //层总高度
var LayerScrollDelay; //每次滚动延迟时间,毫秒
var LayerScrollPixel; //每次滚动的象素值
var idd_up; //向前滚动计时器
var idd_down; //往后滚动计时器
var idd_Stop; //停留时间计时器
var LayerHeight; //层显示部分的高度
var LayerStopTime; //显示一屏后停留时间,毫秒
var LayerStopStatus; //停并状态标识,1:停屏,0:滚动
var LayerShowLines; //每屏显示的行数
//设置初始值
LayerScrollPixel = 4;
LayerScrollDelay = 300;
LayerHeight = 288;
LayerStopTime = 3000;
LayerTopPixel = 0;
LayerStopStatus = 0;
LayerShowLines = 15; //获取层的总高度
function getOffsetHeight(){
LayerOffsetHeight = document.frames('liuswin').document.all.liu.offsetHeight;
}
//加快滚速
function upspeed(){
LayerScrollPixel = LayerScrollPixel + 4 ;
}
//放慢滚速
function dnspeed(){
if(LayerScrollPixel>4){
LayerScrollPixel = LayerScrollPixel - 4;
}
}
//默认滚速
function rsspeed(){
LayerScrollPixel = 4;
}
//默认延迟时间
function rsDelay(){
LayerScrollDelay = 300;
}
//增加延迟时间
function upDelay(){
LayerScrollDelay = LayerScrollDelay + 10;
}
//减少延迟时间
function dnDelay(){
if(LayerScrollDelay>200){
LayerScrollDelay = LayerScrollDelay - 5;
}
}
//默认停屏时间
function rsStopTime(){
LayerStopTime = 3000;
}
//增加停屏时间
function upStopTime(){
LayeyStopTime = LayerStopTime + 1000;
}
//减少停屏时间
function dnStopTime(){
if(LayerStopTime>1000){
LayerStopTime = LayerStopTime - 1000;
}
}
//向前滚动函数
function upscroll(){
//向前滚动层
LayerTopPixel = LayerTopPixel - LayerScrollPixel;
document.frames('liuswin').document.all.liu.style.pixelTop = LayerTopPixel;
//如果已经移到最前则重新滚动
getOffsetHeight()
i = LayerTopPixel + LayerOffsetHeight - LayerHeight
if(i<=0)
{
//clearInterval(idd_up);//停止滚动
LayerTopPixel = 0; //重新滚动
}
//屏间暂停
i = LayerTopPixel % LayerHeight;
if (i==0)
{
stop();
idd_stop=setInterval("pause()",LayerStopTime);
}}
function pause()
{
if (LayerStopStatus == 1)
{
clearInterval(idd_stop);
idd_up=setInterval("upscroll()",LayerScrollDelay);
}
LayerStopStatus = 1;
}
//往后滚动函数
function dnscroll(){
//如果已经滚动到最后则停止移动
if(LayerTopPixel >= 0)
{
clearInterval(idd_down);
}
//往后移动层
LayerTopPixel = LayerTopPixel + LayerScrollPixel;
document.frames('liuswin').document.all.liu.style.pixelTop = LayerTopPixel;
}
//向前滚动
function forw(){
stop()
idd_up=setInterval("upscroll()",LayerScrollDelay)
}
//向后滚动
function next(){
stop()
idd_down=setInterval("dnscroll()",LayerScrollDelay)
}
//停止滚动
function stop(){
clearInterval(idd_up) ;
clearInterval(idd_down) ;
LayerStopStatus = 0;
}
//向后翻页
function pgdn(){
stop();
getOffsetHeight();
if(LayerTopPixel - LayerHeight >= LayerOffsetHeight *- 1)
{
LayerTopPixel = LayerTopPixel - LayerHeight;
document.frames('liuswin').document.all.liu.style.pixelTop = LayerTopPixel;
}
}
//向前翻页
function pgup(){
stop();
getOffsetHeight();
if(LayerTopPixel + LayerHeight <= 0) {
LayerTopPixel = LayerTopPixel + LayerHeight;
}
else {
LayerTopPixel = 0;
}
document.frames('liuswin').document.all.liu.style.pixelTop = LayerTopPixel ;
}
</script>