Home >Web Front-end >HTML Tutorial >html uses marquee to realize text scrolling left and right_HTML/Xhtml_web page production

html uses marquee to realize text scrolling left and right_HTML/Xhtml_web page production

WBOY
WBOYOriginal
2016-05-16 16:36:561650browse

Copy code
The code is as follows:


//With the help of marquee

Here is the content to be scrolled


//Common implementation method

Here is the content to be scrolled

< script language="javascript" type="text/javascript">
function scroll(obj) {
var tmp = (obj.scrollLeft) ;
//When the scroll bar reaches the top on the right
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('scrollobj'))",20);

< /BODY>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn