📜  google搜索输入javascript代码示例

📅  最后修改于: 2022-03-11 15:04:12.148000             🧑  作者: Mango

代码示例1
function takeInput(e) {

    // enter === 13

    if(e.which != 13) {
        return false;
    }

    var question = this.value;

    appendOutput("

HUMAN : " + question + "

", output); appendOutput("

CHATBOT : " + processInput(question) + "

", output); appendOutput('
', output); this.focus(); this.select(); output.scrollByLines(100); } function processInput(question) { var answer = "I cannot answer this question"; if (question.toUpperCase() == "GOOGLE ") { answer = "Here is what I found on Google:"; window.open('https://www.google.com/search?q='); } }