Spaces:
Running
Running
Update index.html
Browse files- index.html +21 -2
index.html
CHANGED
|
@@ -217,17 +217,36 @@ Long time no see!
|
|
| 217 |
Nice to meet you!
|
| 218 |
Good to see you!
|
| 219 |
`
|
|
|
|
| 220 |
const words = word_text.trim().split("\n")
|
|
|
|
| 221 |
for (let word of words){
|
| 222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
}
|
|
|
|
| 224 |
|
| 225 |
}
|
| 226 |
|
| 227 |
|
| 228 |
</script>
|
| 229 |
<div id="buttons">
|
| 230 |
-
|
| 231 |
</div>
|
| 232 |
<input type="text" id="textInput" value ="Hello." placeholder="Enter some text here...">
|
| 233 |
|
|
|
|
| 217 |
Nice to meet you!
|
| 218 |
Good to see you!
|
| 219 |
`
|
| 220 |
+
const container = document.getElementById("buttons")
|
| 221 |
const words = word_text.trim().split("\n")
|
| 222 |
+
let number = 1
|
| 223 |
for (let word of words){
|
| 224 |
+
// ボタンを作成
|
| 225 |
+
const button = document.createElement('button');
|
| 226 |
+
|
| 227 |
+
// ボタンテキストを設定
|
| 228 |
+
button.textContent = "#"+number.toString()+" "+word;
|
| 229 |
+
|
| 230 |
+
// ボタンにクリックイベントを追加
|
| 231 |
+
button.onclick = () => tts(word, number);
|
| 232 |
+
|
| 233 |
+
// ラベルを作成(オプション)
|
| 234 |
+
//const label = document.createElement('span');
|
| 235 |
+
//label.className = 'button-label';
|
| 236 |
+
//label.textContent = 'Label1'; // ラベルテキストは固定値としている
|
| 237 |
+
|
| 238 |
+
// ボタンとラベルをDOMに追加
|
| 239 |
+
container.appendChild(button);
|
| 240 |
+
|
| 241 |
}
|
| 242 |
+
number +=1
|
| 243 |
|
| 244 |
}
|
| 245 |
|
| 246 |
|
| 247 |
</script>
|
| 248 |
<div id="buttons">
|
| 249 |
+
|
| 250 |
</div>
|
| 251 |
<input type="text" id="textInput" value ="Hello." placeholder="Enter some text here...">
|
| 252 |
|