No 6 · js实现回到顶部和双击页面自动滚动

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>    
</head>
<body>
<script type="text/javascript">
var currentpos,timer;
function initialize()
{
timer=setInterval("scrollwindow()",50);
}
function sc(){
clearInterval(timer);
}
function scrollwindow()
{
window.scrollBy(0,1);
}
document.onmousedown=sc
document.ondblclick=initialize
</script>      
    <form id="form1" runat="server" >
        <table>
            <tr>
                <td id="content" align="center" runat="server" style="font-family:楷体_GB2312; font-size:18px;">          
               换行<br />
                换行<br />
                 换行<br />
                  换行<br />
                   换行<br />
                    换行<br />
                     换行<br />
                     换行<br />
                换行<br />
                 换行<br />
                  换行<br />
                   换行<br />
                    换行<br />
                     换行<br />
                     换行<br />
                换行<br />
                 换行<br />
                  换行<br />
                   换行<br />
                    换行<br />
                     换行<br />
                     换行<br />
                换行<br />
                 换行<br />
                  换行<br />
                   换行<br />
                    换行<br />
                     换行<br />
                     换行<br />
                换行<br />
                 换行<br />
                  换行<br />
                   换行<br />
                    换行<br />
                     换行<br />
                     换行<br />
                换行<br />
                 换行<br />
                  换行<br />
                   换行<br />
                    换行<br />
                     换行<br />
                </td>
            </tr>
            <tr>
            <td id="timeDate" align="right" runat="server" style="border-top:solid 1px black;font-family:楷体_GB2312; font-size:18px; height: 23px;">
               
            </td>
            </tr>
            <tr>
                <td align="right">          
                <img alt="回到顶部" src="../../6b6e567cjw1dj5awyvcidj.jpg" style="cursor:hand;" onclick="window.scrollTo(0,0);" />
                </td>
            </tr>
        </table> 
    </form>   
</body>
</html>

你可能感兴趣的:(html,timer,XHTML,server,function,table)