价值10亿的AI代码

作者: 爱学习的新一 | 来源:发表于2019-12-11 11:48 被阅读0次

    滑稽.png

    <!DOCTYPE html>
    <html lang="cn">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    
    </head>
    <body>
    <div class="container">
        <div class="row">
            <div class="jumbotron">
                <h1>价值十亿的AI代码</h1>
                <input type="text" placeholder="输入对话" id="text" class="col-lg-12" style="display: block;height: 50px;font-size: 20px;margin: 30px 0" />
                <input type="button" value="输入" id="btn" class="btn btn-danger" />
            </div>
    
        </div>
        <div class="panel panel-default row">
            <div class="panel-body">
                对话内容:
            </div>
        </div>
    
    </div>
    
    
    <script>
    
        var txt = document.getElementById('text')
        var btn = document.getElementById('btn')
        var msgbox = document.querySelector('.panel-body')
        btn.addEventListener('click',() => {
    
    
            let myself = document.createElement('p')
            myself.innerHTML = '我:' + this.txt.value
            msgbox.appendChild(myself)
    
    
            let child = document.createElement('p')
            child.innerHTML =  this.txt.value.replace(/你/g,'我').replace(/吗/g,'').replace(/\?/g,'!').replace(/?/g,'!')
            msgbox.appendChild(child)
    
    
            this.txt.value = ''
    
        })
    
        txt.addEventListener('keydown',(e)=>{
            if (e.keyCode==13) {
                this.btn.click()
            }
        })
    </script>
    </body>
    </html>
    
    
    

    相关文章

      网友评论

        本文标题:价值10亿的AI代码

        本文链接:https://www.haomeiwen.com/subject/znozgctx.html