如何逐行显示文本,时间跨度为秒。
用户不应该回答。
我想模拟聊天消息。
答案 0 :(得分:0)
这FIDDLE会让你开始。
随机短语数组
一个定时器函数,它随机读取它们并将它们放在div中。
JS
var randomphrases = ['We the people','in order to form','a more perfect union','establish justice','insure domestic tranquility','provide for the common defence, promote the general welfare','and secure the blessings of liberty','to ourselves','and our posterity','do ordain and establish this constitution','of the United States of America'];
var c = 0;
var t;
var timer_is_on = 0;
timedCount();
function timedCount()
{
t = setTimeout( function(){ timedCount() }, 1500 );
random = Math.floor(Math.random() * (11 - 0 + 1)) + 0;
$('.putmehere').html( randomphrases[random]);
}