Copy codeThe Code is as follows:
<! 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>
<TITLE> Use marquee and div + js respectively to achieve the loop rolling effect of the first and end Links </TITLE>
</HEAD>
<BODY>
Use marquee to achieve loop rolling effect (IE only): <br/>
<MARQUEE behavior = "scroll" contenteditable = "true" onstart = "this. firstChild. innerHTML + = this. firstChild. innerHTML; "scrollamount =" 3 "width =" 100 "> <SPAN unselectable =" on "> here is the content to be rolled </SPAN> </MARQUEE>
<Br/> Use DIV + javascript to implement loop scrolling between the beginning and end connections (compatible with firefox): <br/>
<DIV id = "scrolobj" style = "white-space: nowrap; overflow: hidden; width: 500px; "> <span> here is the content to be rolled </span> </DIV>
<Script language = "javascript" type = "text/javascript">
<! --
Function scroll (obj ){
Var tmp = (obj. scrollLeft) ++;
// When the scroll bar reaches the top right of the page
If (obj. scrollLeft = tmp) obj. innerHTML + = obj. innerHTML;
// When the scroll bar scrolls the width of the initial content, the scroll bar returns to the leftmost end.
If (obj. scrollLeft> = obj. firstChild. offsetWidth) obj. scrollLeft = 0;
}
SetInterval ("scroll (document. getElementById ('scrolobj ')", 20 );
// -->
</Script>
</BODY>
</HTML>