===如何改成让它向左滚动?===

zhlym 2004-03-16 07:23:42
以下这段代码是向上滚动的,如何改成让它向左滚动?===
<table border="0" cellpadding="0" cellspacing="0" width="422" height="146">
<tr>
<td width="235" height="146">
<div id="marquees">
数据里面读出来的<br/>
来的<br/>
面读出的<br/>
</div>

<script language="JavaScript">
marqueesHeight=100;
stopscroll=false;

with(marquees){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
//onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
document.write('<div id="templayer" style="position:absolute;z-index:1;visibility:hidden"></div>');

preTop=0; currentTop=0;

function init(){
templayer.innerHTML="";
while(templayer.offsetHeight<marqueesHeight){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;
setInterval("scrollUp()",40);
}
document.body.onload=init;

function scrollUp(){
if(stopscroll==true) return;
preTop=marquees.scrollTop;
marquees.scrollTop+=1;
if(preTop==marquees.scrollTop){
marquees.scrollTop=templayer.offsetHeight-marqueesHeight;
marquees.scrollTop+=1;
}
}
</script>

</td>
</tr>
</table>
...全文
48 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhlym 2004-03-20
  • 打赏
  • 举报
回复
以上提供的都解决不了我的问题,不过也只好结贴了,哎CSDN
zhlym 2004-03-18
  • 打赏
  • 举报
回复
顶.
ryuginka 2004-03-18
  • 打赏
  • 举报
回复
TO pizixt(皮子)

你的代码在不同分辨率下运行会显示不了页面
zhlym 2004-03-17
  • 打赏
  • 举报
回复
顶呀,有没有人帮帮我???/

那位大虾能不能推荐一段支持图片不间断向左移动的代码,3Q

顶呀,有没有人帮帮我???/

那位大虾能不能推荐一段支持图片不间断向左移动的代码,3Q
zhlym 2004-03-17
  • 打赏
  • 举报
回复
那位大虾能不能推荐一段支持图片不间断向左移动的代码,3Q
zhlym 2004-03-17
  • 打赏
  • 举报
回复
TO pizixt(皮子)&zhurenweile(美女珊珊 与 蓝精灵)

皮子,我调试你给的代码,为什么一运行IE就没反应了?或者你们能不能推荐一段支持图片不间断向左移动的代码,3Q
zhurenweile 2004-03-16
  • 打赏
  • 举报
回复
滚动的主体函数是在
function scrollUp(){
if(stopscroll==true) return;
preTop=marquees.scrollTop;
marquees.scrollTop+=1;
if(preTop==marquees.scrollTop){
marquees.scrollTop=templayer.offsetHeight-marqueesHeight;
marquees.scrollTop+=1;
}

里面

你可以试试修改
scrollTop为scrollLeft
pizixt 2004-03-16
  • 打赏
  • 举报
回复
<div id="marquees">
数据里面读出来的<br>
来的<br>
面读出的<br>
</div>

<div id="templayer" style="position:absolute;left:0;top:0;visibility:hidden"></div>
<script language="JavaScript">
marqueesWidth=560;

with(marquees){
style.height=0;
style.width=marqueesWidth;
style.overflowX="hidden";
style.overflowY="visible";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
preLeft=0; currentLeft=0; stopscroll=false;

function init(){
templayer.innerHTML="";
while(templayer.offsetWidth<marqueesWidth){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML+=templayer.innerHTML;
setInterval("scrollLeft()",10);
}init();

function scrollLeft(){
if(stopscroll==true) return;
preLeft=marquees.scrollLeft;
marquees.scrollLeft+=1;
if(preLeft==marquees.scrollLeft){
marquees.scrollLeft=templayer.offsetWidth-marqueesWidth+1;
}
}
</script>
zhlym 2004-03-16
  • 打赏
  • 举报
回复
顶..

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧