HTML
<label class="container"> <input type="radio" name="S1" checked>One</label><br> <label class="container"> <input type="radio" name="S1" >Two</label><br> <label class="container"> <input type="radio" name="S1" >Three</label><br> <label class="container"> <input type="radio" name="S1" >Four</label> <style> .container { cursor: pointer; font-size: 22px; } </style>
<label class="container"> <input type="radio" checked>One</label><br> <label class="container"> <input type="radio" >Two</label><br> <label class="container"> <input type="radio" >Three</label><br> <label class="container"> <input type="radio" >Four</label> <style> .container { cursor: pointer; font-size: 22px; } </style>
<script> var Tag= document.querySelectorAll("input") ; Tag.forEach((round) => { round.addEventListener("click", function() { if(round.value== dp.innerHTML){ round.checked=false ; dp.innerHTML = "?";return } dp.innerHTML = round.value ; }) }) </script>
<script> var Tag= document.querySelectorAll("input") ; Tag.forEach((round) => { round.addEventListener("click", function() { var TT =document.getElementById("dp"+round.value) ; if(TT.style.opacity == 0.3){ TT.style.opacity=1; TT.style.textDecoration = "initial"; } else{ TT.style.opacity=0.3; round.checked=false ; TT.style.textDecoration = "line-through"; } }) }) </script>
沒有留言:
張貼留言