有人可以幫我制作關于在用戶輸入的句子中間添加單詞的html和javascript嗎?謝謝...
句子:Aku sadeng [用戶輸入] disekolah。
輸入框 | 造句的按鈕
已添加到單詞并由用戶輸入的句子的結果 ex:
阿庫薩格馬坎迪斯科拉。
uj5u.com熱心網友回復:
對于 html 正文:
<p>Aku sedang <span id="sentence">_____</span> di sekolah.</p>
<input type="text" id="userInput"> <button onclick="readMore()">modify</button>
然后添加腳本
<script>
function readMore(){
let word = document.getElementById("userInput").value;
document.getElementById("sentence").innerHTML = word;
}
</script>
你可以在這里閱讀 HTML DOM 的其他可用性
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/493880.html
標籤:javascript html 用户输入
上一篇:反應組件不使用路由渲染
