*** 打印机效果代码整理

访客3年前黑客工具835

纯js性 简单快速 功能少

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>打字机效果</title>
</head>
<body>
<div id="HotNews">

</div>
<script type="text/javascript">
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]="#";
newstitle[1]="关心身体,就是关心自己";
newshref[1]="#";
newstitle[2]="去 *** 旅游了";
newshref[2]="#";
newstitle[3]="大雨倾盆,很大呀";
newshref[3]="#";
function shownew(){
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>
</html>

输出完一句消失再输出一句

全文js打印机输入

<html><head><title>Type Write</title><style type="text/css">a{text-decoration:none}</style></head><body>  
<div id="newsticker"><span id="tickertitle"></span><a id="typewriter" href="#"></a></div>  
</body>  
</html>  
<script type="text/javascript">  
// please keep these lines on when you copy the source  
// made by: Nicolas - http://www.javascript-page.com  
var current = 0  
var x = 0  
var speed = 70  
var speed2 = 2000  
function initArray(n) {  
  this.length = n;  
  for (var i =1; i <= n; i++) {  
    this[i] = ' '  
  }  
}  
typ = new initArray(16);  
typ[0]="406:red:Texas last in US Gov State Governors Websites (June 2008)";  
typ[1]="409:red:The Insolvency Service last in UK Central Government (June 2008)";  
typ[2]="384:green:Federated States of Micronesia 1st in US Gov State and Territorial Government Websites (April 2008)";  
typ[3]="413:green:U.S. Immigration and Customs Enforcement highest climber in US Gov Federal Agencies  (up 188) - June 2008";  
typ[4]="371:green:Iowa 1st in US Gov State Governors Websites (April 2008)";  
typ[5]="373:green:Directgov Jobs and Skills 1st in UK Central Government (April 2008)";  
typ[6]="379:red:Birmingham last in UK Local Government (April 2008)";  
typ[7]="406:green:Utah highest climber in US Gov State Governors Websites (up 16) - June 2008";  
typ[8]="380:red:Kent Police greatest faller in Police Forces (down 31) - April 2008";  
function typewrite() {  
  var m = typ[current];  
  document.getElementById("typewriter").href = '/survey/report.html?rt=' + m.substring(0,m.indexOf(':'));  
  m = m.substring(m.indexOf(':') + 1);  
  document.getElementById("typewriter").style.color = m.substring(0,m.indexOf(':'));  
  m = m.substring(m.indexOf(':') + 1);  
  m = m.replace("&","and");  
  document.getElementById("typewriter").innerHTML = m.substring(0, x++) + "_";  
    
  if (x == m.length + 1) {  
    x = 0  
    current++  
    if (current > typ.length - 1) {  
      current = 0  
    }  
    setTimeout("typewrite()", speed2)  
    }  
  else {  
    setTimeout("typewrite()", speed)  
  }  
}  
//document.getElementById("tickertitle").innerHTML = "Latest: ";  
/*document.getElementById(" *** Headlines").style.padding = "10px";*/  
typewrite()  
</script>

纯js的输出总是略显不足更好的打字机效果还是需要插件支持。飞机票下一篇文章

标签: *** 实例

相关文章

js获取当前位置

手机端获取城市名称 百度地图接口 引入百度api<script src="http://api.map.baidu.com/api?v=1.4" type="text/javascript"...

浏览器网页定时刷新代码教程分享

浏览器网页定时刷新代码教程分享,只需要一段js代码 首先F12打开控制器面板,复制刷新代码 timeout=prompt("Set timeout (Second):"); count=...

简单理解jQuery中$.getJSON、$.get、$.post、$.ajax用法

1.$.getJSON   $.getJSON()是专门为ajax获取json数据而设置的,并且支持跨域调用,其语法的格式为: $.getJSON(       url,             ...

利用js代码批量自动取消抖音所有关注 解放双手

本文是利用js代码批量自动取消抖音所有关注 解放双手 有时候我们抖音关注的人太多,想要批量取消但是一个一个点击太麻烦了,如何解放双手批量取消关注呢?所以思源研究了一下,写了一段js代码,在线...

资源网,博客文章页面增加访问停留时间代码

资源网,博客文章页面增加访问停留时间代码 <!-- 统计访客停留时间 --> <div id="tingliu"> </span> <span clas...

浏览器使用js代码快速删除微博内容

本文是分享如何用浏览器使用js代码快速删除微博内容 方法步骤 1.电脑进入自己微博主页->然后右键鼠标->审核米素->点下面的 2.第二个英文“Console”...