<!doctype html><title>javascript Seamless scrolling </title><meta charset= "Utf-8"/><meta name= " Keywords "content=" javascript seamless scrolling "/><meta name=" description "content=" JavaScript seamless scrolling "/><base href=" http://images.cnblogs.com/cnblogs_com/rubylouvre/199042/"><style type=" Text/css "> H1 {font:400 16px/1" Microsoft Yahei ", Kaiti_gb2312,simsun} #marquee, #marquee li {padding:0; margin:0; } #marquee {position:relative; List-style:none; height:150px; width:250px; Overflow:hidden; border:10px solid #369; } #marquee li {position:absolute; } #marquee img {display:block; border:0; }</style><script type= "Text/javascript" > var Marquee = function (id) {Try{document.execcommand (" Backgroundimagecache ", false, True);} catch (e) {}; var container = document.getElementById (id), slide = container.getelementsbytagname ("li") [0], speed = arguments[1] | | Delta = 0,//The current scroll position critical = Slide.offsetheight;//critical point slide.innerhtml + = slide.innerhtml; var rolling = function () {Delta = =-critical? delta = 0:delta--; Slide.style.top = Delta + "px"; } var timer = setinterval (rolling,speed)//Set Timer container.onmouseover=function () {clearinterval (timer)}//Mouse move to Marquee On, clear timer, stop scrolling container.onmouseout=function () {timer=setinterval (rolling,speed)}//Reset timer when mouse is removed} window.onload = Funct Ion () {Marquee ("Marquee"); }</script><p>javascript Seamless scrolling (scroll up) </p><base href= "http://images.cnblogs.com/cnblogs_com/ rubylouvre/199042/"><ul id=" marquee "> <li> <a href=" Http://www.cnblogs.com/rubylouvre/">< IMG src= "o_s017.jpg" alt= "seamless scrolling"/></a> <a href= "http://www.cnblogs.com/rubylouvre/" ></a> <a href=" http://www.cnblogs.com/rubylouvre/"></a> <a href= "http://www.cnblogs.com/rubylouvre/" ></a> <a href=" http://www.cnblogs.com/rubylouvre/"></a> <a href= "http://www.cnblogs.com/rubylouvre/" ></a > <a href= "http://www.cnblogs.com/rubylouvre/" ></a> </li& Gt;</ul>
Run code
JavaScript picture Scrolling