diff options
author | Timothy Flynn <trflynn89@pm.me> | 2021-04-03 09:03:11 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-03 15:39:46 +0200 |
commit | 274e94224d23873a74b1a24fc8ded1e5a3d6e66f (patch) | |
tree | f73652fe7d22c38858b29a217a647ff22cb2c8e7 /Base/res/html/misc/radio.html | |
parent | 136d774885cb0d6be2eb25300797f9eff6c1f39f (diff) | |
download | serenity-274e94224d23873a74b1a24fc8ded1e5a3d6e66f.zip |
Base: Add test page for HTML input type=radio elements
Diffstat (limited to 'Base/res/html/misc/radio.html')
-rw-r--r-- | Base/res/html/misc/radio.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Base/res/html/misc/radio.html b/Base/res/html/misc/radio.html new file mode 100644 index 0000000000..a47cfdd7f6 --- /dev/null +++ b/Base/res/html/misc/radio.html @@ -0,0 +1,52 @@ +<body> + <b>Pick your house!</b> + <br /> + <input type=radio id=gryffindor name=hp value=Gryffindor> + <label for=gryffindor>Gryffindor</label> + <br /> + <input type=radio id=hufflepuff name=hp value=Hufflepuff> + <label for=hufflepuff>Hufflepuff</label> + <br /> + <input type=radio id=ravenclaw name=hp value=Ravenclaw> + <label for=ravenclaw>Ravenclaw</label> + <br /> + <input type=radio id=slytherin name=hp value=Slytherin> + <label for=slytherin>Slytherin</label> + + <br /> + <br /> + + <b>Pick your other house!</b> + <br /> + <input type=radio id=stark name=got value=Stark> + <label for=stark>Stark</label> + <br /> + <input type=radio id=lannister name=got value=Lannister> + <label for=lannister>Lannister</label> + <br /> + <input type=radio id=baratheon name=got value=Baratheon> + <label for=baratheon>Baratheon</label> + <br /> + <input type=radio id=targaryen name=got value=Targaryen> + <label for=targaryen>Targaryen</label> + + <script> + const hp = document.getElementsByName('hp'); + for (let i = 0; i < hp.length; ++i) { + hp[i].addEventListener('change', function() { + if (this.checked) { + console.log('HP house:', this.value); + } + }); + } + + const got = document.getElementsByName('got'); + for (let i = 0; i < got.length; ++i) { + got[i].addEventListener('change', function() { + if (this.checked) { + console.log('GoT house:', this.value); + } + }); + } + </script> +</body> |