是的,最近都在做大学生也能做的东西,anyway, 拓宽知识面,js远比我想象的强大。
(忽视那个asp.net的变量声明,那个是从数据库取的数据)
<div id="pro"><a href="product_type.aspx?product_type_id=9" class="a_display"><div class="title"><h1>产品推荐</h1><div class="go"></div></div></a>
<div id="picdemo"><pre name="code" class="html"> <%=table_define %>
<tbody>
<tr>
<td id="picdemo1" valign="top" >
<%=product_overview %>
</td>
<td id="picdemo2" valign="top" >
</td>
</tr></tbody></table>
</div>
</div>
<script>
var speed = 30
picdemo2.innerHTML = picdemo1.innerHTML
function MarqueePic() {
if (picdemo2.offsetWidth - picdemo.scrollLeft <= 0) {
picdemo.scrollLeft -= picdemo1.offsetWidth
}
else {
picdemo.scrollLeft = picdemo.scrollLeft + 1
}
}
var MyMarPic = setInterval(MarqueePic, speed)
picdemo.onmouseover = function () { clearInterval(MyMarPic) }
picdemo.onmouseout = function () { MyMarPic = setInterval(MarqueePic, speed) }
</script>