<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>AI</title> <style> body{text-align:center} </style> <script> function replaceAndDisplay() { var inputText = document.getElementById('inputText').value; var replacedText = inputText.replace(/吗/g, '').replace(/\?/g, '!').replace(/\?/g, '!'); var historyDiv = document.getElementById('history'); var inputItem = document.createElement('p'); inputItem.innerText = "我: " + inputText; historyDiv.appendChild(inputItem); var replacedItem = document.createElement('p'); replacedItem.innerText = "回复: " + replacedText; historyDiv.appendChild(replacedItem); } </script> </head> <body> <input type="text" id="inputText"> <button onclick="replaceAndDisplay()">发送</button> <div id="history"></div> </body> </html> 提示:你可以先修改部分代码再运行。 转载请注明:有爱前端 » 价值一个亿的AI代码 喜欢 (0)or分享 (0)