打字效果

 

 

var NewsTime = 2000;    //每条新闻的停留时间
  var TextTime = 50;        //新闻标题文字出现等待时间,越小越快

  var newsi = 0;
  var txti = 0;
  var txttimer;
  var newstimer;

  var newstitle = new Array();    //新闻标题
  var newshref = new Array();        //新闻链接

  newstitle[0] = "";啊啊啊啊啊啊啊啊啊啊
  newshref[0] = "http://www.baidu.com/";

  newstitle[1] = "http://www.baidu.com/";
  newshref[1] = "http://www.baidu.com/";

  newstitle[2] = "显而易见,最高的效率就是对现有材料的最佳利用。";
  newshref[2] = "http://www.baidu.com/";

  newstitle[3] = "学会偷懒,并懒出境界是提高工作效率最有效的方法!";
  newshref[3] = "http://www.baidu.com/";

  newstitle[4] = "bye";
  newshref[4] = "http://www.baidu.com/";

  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();

 

 

<p><a href="http://www.baidu.com" target="_blank">百度一下</a></p>

 

转载于:https://www.cnblogs.com/mudeng-007/p/7059343.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值