5行のコードは人工知能を実現します.
14461 ワード
最短コードで人工知能を実現
//ははははははははは
//ははははははははは
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Documenttitle>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
head>
<body>
<div class="container">
<div class="row">
<div class="jumbotron">
<h1> 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>