html5短信链接自动内容,HTML5 信息自动传播(自动打字)动画

JavaScript

语言:

JaveScriptBabelCoffeeScript

确定

! function() {

"use strict";

function txtTyper() {

if (idx <= str.length) {

if (str.charAt(idx) == '

while (str.charAt(idx) != '>' || str.charAt(idx + 1) == '

idx++

}

if (str.charAt(idx) == '&' && str.charAt(idx + 1) != ' ') {

while (str.charAt(idx) != ';') idx++;

idx++;

}

var tmp0 = str.slice(0, idx);

var tmp1 = str.charAt(idx++);

idObj.innerHTML = '' + tmp0 + '' + tmp1 + '_';

if (idx < str.length) {

setTimeout(function() {

txtTyper();

}, 120);

} else {

sound = false;

}

}

}

var str = "
---- beginning of transmission ----
Who bears the greater blame
for the encroachment of tyranny:
those who plan to smother our freedoms tomorrow,
or those who act to smother our questions today?
---- end of transmission ----
";

var sound = true;

var idx = 0;

var idObj = document.getElementById('ttl0');

if (window.Audio) {

var notlogical = new Audio('/uploads/151101/sing.mp3');

notlogical.addEventListener('ended', function() {

this.currentTime = 0;

if (sound) this.play();

}, false);

notlogical.play();

}

txtTyper();

}();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值