我正在使用此src =“http://code.responsivevoice.org/responsivevoice.js”(TTS),我想让3条消息循环播放,直到用户点击在屏幕上某处。重复功能,直到按下屏幕
播放3条消息,它们之间有某种间隔,先..间隔......秒......间隔......第三个......重复直到点击,它们重复直到屏幕被按下,任何想法?试过,但失败了
var text1 = "This is the first message";
var text2 = "This is the second message";
var text3 = "This is the third message";
var text4 = "This is the fourth message";
function toggleThem()
{
window.setTimeout(function(){
responsiveVoice.speak(text1);
}, 200);
window.setTimeout(function(){
responsiveVoice.speak(text2);
},2000);
window.setTimeout(function(){
responsiveVoice.speak(text3);
}, 2500);
}
toggleThem();
不使用超时,使用事件 – dandavis
为什么不根据条件 – binariedMe