你如何让单词从列表中打字出来?例如instructables.com

How do you make words type out from a list? ex. instructables.com

本文关键字:例如 com instructables 单词 列表      更新时间:2023-09-26

我正在尝试创建类似于"Let Make"的东西_,其中单词是从http://www.instructables.com/.

尝试在这里搜索或谷歌搜索"随机单词列表"和类似的术语,但一无所获。

如果能提供任何关于使用何种语言或功能来创建它的指导,我们将不胜感激。

类似的内容(http://jsfiddle.net/ARsyj/)也可以为你指明正确的方向:

var arrWordsList = ["ice cream", "bikes", "jewelry"];
var iCurrentWordIndex = 0;
var iCurrentLetterIndex = 0;
var iIntervalId;
function startPrintWords(iInterval) {
    iIntervalId = setInterval(printWords, iInterval);
}
function stopPrintWords() {
    clearInterval(iIntervalId);
}
function printWords() {
    if(iCurrentWordIndex + 1 > arrWordsList.length) {
        stopPrintWords();
        return;
    }
    var strCurrentText = $("#textbox").val();
    var strCurrentWord = arrWordsList[iCurrentWordIndex];
    $("#textbox").val(strCurrentText 
                      + strCurrentWord.charAt(iCurrentLetterIndex));
    if(strCurrentWord.length == iCurrentLetterIndex) {
        iCurrentLetterIndex = 0;
        iCurrentWordIndex++;
        $("#textbox").val("");
    } else {
        iCurrentLetterIndex++;
    }
}
$(document).ready(function () {
   startPrintWords(1000); 
});

您可以从以下内容开始—http://jsfiddle.net/HhTVd/

var word   = ['i', ' l', 'i', 'k', 'e ',  'c', 'a', 'k', 'e'].reverse();
var intervalTimer = setInterval(function(){
    if (word.length == 0) {
        clearInterval(intervalTimer);//clear the timer wehn we have no letters
        return;
    }
    $('#txt').val($('#txt').val() + word.pop())
}, 300)