Skip to content

Commit 99b5767

Browse files
committed
feat: bấm vô chữ là thay đổi ngẫu nhiên
1 parent d86dd4c commit 99b5767

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

index.html

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<button id="ASong" onClick="playPause()">
1+
<button id="sound" onClick="playPause()">
22
<audio src="https://ff83c814-a2d5-4105-9a45-be3bec448ed7.mdnplay.dev/shared-assets/audio/t-rex-roar.mp3"></audio>
3-
Song
3+
Sound
44
</button>
55

6-
<div id="text"></div>
6+
<div id="text" onClick="change()"></div>
77

88
<script>
9-
const aud = document.getElementById("ASong").children[0];
9+
const aud = document.getElementById("sound").children[0];
1010
const isPlaying = false;
1111
aud.pause();
1212

@@ -18,23 +18,21 @@
1818
}
1919
isPlaying = !isPlaying;
2020
}
21+
2122
const list = ["a", "b", "c", "d"]
2223
document.getElementsByTagName("div")[0].innerHTML=list.at(list.length*Math.random())
24+
function change() {
25+
document.getElementsByTagName("div")[0].innerHTML=list.at(list.length*Math.random())
26+
}
2327
</script>
2428

2529
<style>
26-
/*
27-
Source - https://stackoverflow.com/a/79593630
28-
Posted by WOW RAKIBUL
29-
Retrieved 2026-06-29, License - CC BY-SA 4.0
30-
*/
31-
32-
html, body {
33-
height: 100%;
34-
margin: 0;
35-
display: flex;
36-
justify-content: center; /* Centers horizontally */
37-
align-items: center; /* Centers vertically */
38-
zoom: 2
39-
}
30+
html, body {
31+
height: 100%;
32+
margin: 0;
33+
display: flex;
34+
justify-content: center; /* Centers horizontally */
35+
align-items: center; /* Centers vertically */
36+
zoom: 2
37+
}
4038
</style>

0 commit comments

Comments
 (0)