Home > Web Front-end > JS Tutorial > Use JavaScript to animate the title of the web page_Text effects

Use JavaScript to animate the title of the web page_Text effects

WBOY
Release: 2016-05-16 18:11:20
Original
1288 people have browsed it

HTML Title:

Copy code The code is as follows:
Hello, Mr-S.R Lee< /title></div> <br>JavaScript: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="58177" class="copybut" id="copybut58177" onclick="doCopy('code58177')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code58177"> <br>< ;script type="text/javascript"> <br>function scroll() { <br>//Get title information. <br>var titleInfo = document.title; <br>//Get the first Chinese character (number, letter) of title. <br>//Note: The index of the first character in the string is 0. If the parameter index is not between 0 and string.length, this method returns an empty string. <br>var firstInfo = titleInfo.charAt(0); <br>//Get the second to last information. <br>var lastInfo = titleInfo.substring(1, titleInfo.length); <br>//Splicing output information <br>document.title = lastInfo firstInfo; <br>} <br>//Use setInterval() method to execute <br>setInterval("scroll()", 500); <br></script> <br> </div> <br>Full demo code:<br><div class="htmlarea"> <textarea id="runcode88489"> <title>Hello, Mr-S.R Lee
[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template