怎么把向左滚动的代码改正上向下滚动?

发布网友 发布时间:2024-10-24 00:52

我来回答

2个回答

热心网友 时间:2天前

有几种方式,一种是用<marquee>标签,不过滚动后有留白,另一种是用DIV+JS循环滚动!给你个案例:照着写就好了!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>图片轮播</title>
</head>
<body>
<TABLE cellSpacing=0 cellPadding=0 width=750 align=center border=0>
<TBODY>
<TR>
<TD><style type="text/css">
<!--
#demo {
overflow:hidden;
border: 0px dashed #CCC;
width: 970px;
height: 155px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>

<div id="demo">
<div id="indemo">
<div id="demo1">
<table width="180" border="0" cellspacing="2" cellpadding="0">
<tr>
<td><table width=880 border="0" cellpadding="0" cellspacing="3">
<tr>
<td align="left"><table border="0" cellpadding="0" cellspacing="2" style="border:1px solid #B5B5B5" onMouseOver="this.style.border='1px solid #ebd1aa'" onMouseOut="this.style.border='1px solid #B5B5B5'">
<tr>
<td width="160" height="120" align="center" valign="middle">1</td>
</tr>
</table></td>
<td align="left"><table border="0" cellpadding="0" cellspacing="2" style="border:1px solid #B5B5B5" onMouseOver="this.style.border='1px solid #ebd1aa'" onMouseOut="this.style.border='1px solid #B5B5B5'">
<tr>
<td width="160" height="120" align="center" valign="middle">2</td>
</tr>
</table></td>
<td align="left"><table border="0" cellpadding="0" cellspacing="2" style="border:1px solid #B5B5B5" onMouseOver="this.style.border='1px solid #ebd1aa'" onMouseOut="this.style.border='1px solid #B5B5B5'">
<tr>
<td width="160" height="120" align="center" valign="middle">3</td>
</tr>
</table></td>
<td align="left"><table border="0" cellpadding="0" cellspacing="2" style="border:1px solid #B5B5B5" onMouseOver="this.style.border='1px solid #ebd1aa'" onMouseOut="this.style.border='1px solid #B5B5B5'">
<tr>
<td width="160" height="120" align="center" valign="middle">4</td>
</tr>
</table></td>
<td align="left"><table border="0" cellpadding="0" cellspacing="2" style="border:1px solid #B5B5B5" onMouseOver="this.style.border='1px solid #ebd1aa'" onMouseOut="this.style.border='1px solid #B5B5B5'">
<tr>
<td width="160" height="120" align="center" valign="middle">5</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</div>
<div id="demo2"></div>
</div>
</div>

<script>
<!--
var speed=10; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab2.offsetWidth-tab.scrollLeft<=0)
tab.scrollLeft-=tab1.offsetWidth
else{
tab.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() ;
tab.onmouseout=function() ;
-->
</script>
</TD></TR></TBODY></TABLE></TD></TR></TABLE>
</BODY></HTML>

热心网友 时间:2天前

楼下的那个应该没有问题

<div style="overflow:hidden;height:264px;line-height:22px;font-size:14px" id="marqueebox0"> <!--line-height:文字行距-->
<a href='http://hi.baidu.com/凌殊' target='_blank'>凌殊</a><br>
<a href='http://hi.baidu.com/songkangzhijia' target='_blank'>宋康</a><br>
<a href='http://hi.baidu.com/yuanjinlong' target='_blank'>我的空间</a><br>
<a href='http://hi.baidu.com/logistics_zone' target='_blank'>物流区</a><br>
<a href='http://hi.baidu.com/yx017' target='_blank'>孤鹜空间</a><br>
<a href='http://hi.baidu.com/厚土载物' target='_blank'>包_罗_万_象</a><br>
<a href='http://hi.baidu.com/shsyyz' target='_blank'>上海山艺艺术涂装</a><br>
<a href='http://hi.baidu.com/zhouxiaoli66' target='_blank'>数控火焰切割系统 (北京斯...</a><br>
<a href='http://hi.baidu.com/linzibaobei' target='_blank'>● ` 籹z!</a><br>
<a href='http://hi.baidu.com/minilyx' target='_blank'>娴情饰界</a><br>
<a href='http://hi.baidu.com/qq641823798' target='_blank'>不做有情人</a><br>
<a href='http://hi.baidu.com/mudanguohua' target='_blank'>变频供水设备与气压供水设备</a><br>
<a href='http://hi.baidu.com/huange19' target='_blank'>藕香榭</a><br>
<a href='http://hi.baidu.com/wosheizi123' target='_blank'>o淡笑`ミ</a><br>
<a href='http://hi.baidu.com/mingxing_ccc' target='_blank'>明星汽修学校,汽修技术的专家</a><br>
<a href='http://hi.baidu.com/wenbojun1990' target='_blank'>メ诚鍩﹏①个人</a><br>
<a href='http://hi.baidu.com/hennio' target='_blank'>м▂咒 〣丶</a><br>
<a href='http://hi.baidu.com/shuiguonvhai' target='_blank'>水果女孩~~de梦</a><br>
<a href='http://hi.baidu.com/yanri' target='_blank'>雪之华的空间</a><br>

</div><script>
<!--
function startmarquee(lh,speed,delay,index){
var t;
var p=false;
var o=document.getElementById("marqueebox"+index);
o.innerHTML+=o.innerHTML;
o.onmouseover=function(){p=true}
o.onmouseout=function(){p=false}
o.scrollTop = 0;
function start(){
t=setInterval(scrolling,speed);
if(!p) o.scrollTop += 2;
}
function scrolling(){
if(o.scrollTop%lh!=0){
o.scrollTop += 2;
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0;
}else{
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
}
startmarquee(22,50,3000,0);
/**startmarquee(一次滚动高度,速度,停留时间,图层标记);**/

//-->
</script>
声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。
E-MAIL:11247931@qq.com