Use JS to achieve the typing effect of the link with the news title _ Link effects

Source: Internet
Author: User
Tags setinterval
<ptml> <pead> <title> Web typing effect with linked news title </title> <meta http-equiv= "Content-type" content= " text/html; charset=gb2312 "> <style type=" text/css "> Body{font-size:14px;font-weight:bold;} </style> </pead> <body> Latest content: <script language= "JavaScript" > <!--var newstime = 2000; Stay time of each news var texttime = 50; News title text appears waiting time, the smaller the faster the var newsi = 0; var txti = 0; var Txttimer; var Newstimer; var newstitle = new Array (); News title var newshref = new Array (); News link Newstitle[0] = "about the relevant description of the site"; Newshref[0] = "Http://linkweb.cn/Js/ShowNews.asp?ID=1"; NEWSTITLE[1] = "The use of the Control Panel of the site introduction"; NEWSHREF[1] = "http://linkweb.cn/Js/ShowNews.asp?ID=2"; NEWSTITLE[2] = "added part of the tutorial article to enrich the content"; NEWSHREF[2] = "http://linkweb.cn/Js/ShowNews.asp?ID=3"; NEWSTITLE[3] = "Complete the change of the message board"; NEWSHREF[3] = "http://linkweb.cn/Js/ShowNews.asp?ID=4"; NEWSTITLE[4] = "Thousands of exquisite effects continue to add"; NEWSHREF[4] = "http://linkweb.cn/Js/ShowNews.asp?ID=5"; FunctIon Shownew () {//code by Haiwa @2005-10-21 www.51windows.net var endstr = "_" Hwnewstr = Newstitle[newsi] ; Newslink = Newshref[newsi]; if (txti== (hwnewstr.length-1)) {endstr= "";} if (txti>=hwnewstr.length) {clearinterval (Txttimer); Clearinterval (Newstimer); newsi++; if (newsi>=newstitle.length) {newsi = 0} Newstimer = setinterval ("Shownew ()", newstime); Txti = 0; Return } clearinterval (Txttimer); document.getElementById ("Hotnews"). Href=newslink; document.getElementById ("Hotnews"). InnerHTML = hwnewstr.substring (0,txti+1) +endstr; txti++; Txttimer = SetInterval ("Shownew ()", texttime); } shownew (); --> </SCRIPT> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

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.