0
<!DOCTYPE html>
<html>
<body>

  What color do you prefer?<br>

  <input type="radio" name="colors" id="1">Red<br>
  <input type="radio" name="colors" id="2">Blue

<script>
function myFunction() {
  var x = document.getElementById("1").checked;
 if (x==false)
{document.getElementById("demo").innerHTML="Chọn red ku";}
else
{
 document.getElementById("demo").innerHTML =x;}}
</script>
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>
</body>
</html>

Đăng nhận xét

 
Top