JavaScript makes your page headlines flare up

Source: Internet
Author: User
Tags setinterval

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.