If you have used WEBQQ, you may find that each time you receive the message, you will see the title hint which netizen or group to information, and then the title of the page will begin to float, quite humane, quite interesting. And this effect is actually not difficult, here to achieve this effect, the demo can see the title of this page. Hefeng County Tobacco Monopoly Bureau
The following gives the JavaScript implementation code, attach the note, should be very understood.
JavaScript Code:
<script type= "Text/javascript" > var dir = "Left"; function Scroll () {//Get title var title = Document.title; if (dir = = "Left") {//Gets the title first kanji (numbers, letters). var firstch = title.charat (0);//Get second-to-last information var leftstr = title.substring (1, title.length);//splicing Output information Document.title = Leftstr + firstch; } else if (dir = = "Right") { var lastch = Title.charat (title.length-1); var leftstr = title.substring (0, title.length-1); Document.title = Lastch + leftstr; } else { ; } } function Setdir (d) { dir = D; } Use the SetInterval () method to perform the SetInterval ("scroll ()"); </script>
JavaScript makes your page headlines flare up