• 背景自动滚动


    From:http://bbs.blueidea.com/thread-2970016-1-1.html


    代码
    <!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>
    <script type="text/javascript">
    window.onload
    = function(){
    var scrollBackground = {
    object:document.getElementById(
    "scrollBackground"),
    endTop:
    3700,
    nowTop:
    0
    };

    var scrollInterval = setInterval(function(){
    scrollBackground.nowTop
    = (scrollBackground.nowTop!=scrollBackground.endTop)?(scrollBackground.nowTop+1):0;
    scrollBackground.object.style.backgroundPosition
    = "0px -" + scrollBackground.nowTop + "px";
    },
    50);
    }
    </script>
    </head>
    <body style="margin:0; padding:0">
    <div id="scrollBackground" style="1440px; height:300px; background:url(http://youlove.us/template/theme/youloveus/img/bg.jpg) no-repeat 0 0"></div>00;">
    </body>
    </html>
    <!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>
    <script type="text/javascript">
    window.onload = function(){
    	var scrollBackground = {
    		object:document.getElementById("scrollBackground"),
    		endTop:3700,
    		nowTop:0
    	};
    	
    	var scrollInterval = setInterval(function(){
    		scrollBackground.nowTop = (scrollBackground.nowTop!=scrollBackground.endTop)?(scrollBackground.nowTop+1):0;
    		scrollBackground.object.style.backgroundPosition = "0px -" + scrollBackground.nowTop + "px";
    	},50);
    }
    </script>
    </head>
    <body style="margin:0; padding:0">
    <div id="scrollBackground" style="1440px; height:300px; background:url(http://youlove.us/template/theme/youloveus/img/bg.jpg) no-repeat 0 0"></div>
    </body>
    </html>
    
    
    
  • 相关阅读:
    Arduino-串口函数Serial
    声之翼——超声波模块
    Arduino入门教程--课前准备--Arduino驱动安装及1.0 IDE菜单介绍
    光之触角——光敏电阻、光敏二极管、光敏三极管与光照发生器
    reactjs--父组件调用子组件的内部方法(转载)
    React怎么创建.babelrc文件
    第一课 矩阵的行图像与列图像(麻省理工公开课:线性代数)【转载】
    单片机引脚间状态传递(非转载)
    sublime text2卸载和重新安装(转载)
    C语言头文件怎么写?(转载)
  • 原文地址:https://www.cnblogs.com/jikey/p/1711013.html
Copyright © 2020-2023  润新知