Js图片滚动

参考博文:http://blog.chinaunix.net/uid-12304670-id-2947067.html

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<div id=demo style="overflow:hidden; width:128px; height:300px;">
<div id=demo1>
<img src="1.jpg" title="1"/><br>
<img src="2.jpg" title="2"/><br>
<img src="3.jpg" title="3"/><br>
<img src="4.gif" title="4"/><br>
<img src="6.gif" title="6"/><br>
<img src="7.gif" title="7"/><br>
<img src="9.jpg" title="9"/><br>
</div>
<div id=demo2></div>
</div>
<script language="javascript">
var speed = 30;
demo2.innerHTML = demo1.innerHTML;
var MyMar = setInterval(Marquee, speed)
demo.onmouseover = function() { clearInterval(MyMar) }
demo.onmouseout = function() { MyMar = setInterval(Marquee, speed) }

function Marquee() {
if (demo2.offsetTop - demo.scrollTop <= 0)
demo.scrollTop -= demo1.offsetHeight
else {
demo.scrollTop++
}
}
</script>

</asp:Content>

上一篇:C++内联函数与宏定义


下一篇:Linux服务器之间的目录共享