这次使用爆火的chatgpt生成计算文字个数的网页。 问他用html,css,js生成计算文字个数的网页: write full code to count the number of words in a txt area, with html,css and javascript 回答如下: Word Counter textarea { width: 100%; height: 200px; margin-bottom: 10px; } #count { font-size: 1.2em; color: #333; margin-bottom: 10px; } Word Counter const input = document.getElementById("input"); const count = document.getElementById("count"); function updateCount() { const text = input.value.trim(); const words = text.split(/\s+/); count.textContent = `Word count: ${words.length}`; } input.addEventListener("input", updateCount); 英文计算单词是没问题的,中文就不太……

阅读全文