为什么不会滚动,一段JS滚动代码
我的代码如下:
<table style="width: 250px">
<tr>
<td style="width: 250px; height: 35px">
<table style="border-right: LightSkyBlue 1px solid; border-top: LightSkyBlue 1px solid; background-image: url(image/dd.gif);
border-left: LightSkyBlue 1px solid; width: 250px; border-bottom-style: none">
<tr>
<td style="width: 150px">
优秀汽配厂商推荐</td>
<td align="right" style="width: 100px">
more>></td>
</tr>
</table>
<div id=demo style=overflow:hidden;height:200;width:150>
<div id=demo1>
<asp:DataList ID="DataList_qipei" runat="server" Font-Size="Small" Height="100px"
ShowHeader="False" Width="250px" BorderColor="LightSkyBlue" BorderWidth="1px">
<ItemTemplate>
<table style="width: 100%">
<tr>
<td style="width: 180px" align="left">
<asp:HyperLink ID="HyperLink_zheng" runat="server" NavigateUrl='<%#Eval("企业号","show_news.aspx?company_id={0}") %>'
Text='<%#Eval("企业名").ToString().Trim().Length>13?Eval("企业名").ToString().Trim().Substring(0,13)+"...":Eval("企业名").ToString().Trim() %>'></asp:HyperLink></td>
<td style="width: 70px">
<%#Convert.ToDateTime(Eval("注册时间").ToString()).ToShortDateString() %>
</td>
</tr>
</table>
</ItemTemplate>
<ItemStyle Font-Size="Small" />
</asp:DataList>
</div>
<div id=demo2></div>
</div>
<script>
var speed=30;
demo2.innerHTML=demo1.innerHTML
function Marquee()
{
if(demo2.offsetTop-demo.scrollTop<=0)
demo.scrollTop-=demo1.offsetHeight;
else
demo.scrollTop++;
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
</td>
</tr>
</table>
------解决方案--------------------参考dh君的
向上滚动
HTML code
<html>
<head>
<title>dhScrollUp</title>
<style>
.dhMarquee {width:100px;height:100px;text-align:left;margin:0px;padding:0px;border:1px solid #000;overflow:hidden;white-space:nowrap;}
.mqdemo {margin:0px;padding:0px;border:0px;}
.dhScrollA {font-size:12px;display:block;padding:2px;}
</style>
</head>
<body>
<div id="mq" class="dhMarquee" onmouseover="iScrollAmount=0" onmouseout="iScrollAmount=1">
<div id="mqdemo" class="mqdemo">
<a class="dhScrollA" href="javascript:alert('1')">月圆之夜</a>
<a class="dhScrollA" href=