Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Radio checked

The checked property is a Boolean value used to determine whether a radio button is in a checked or unchecked state. <html>     <head>     <title> Example of the radio checked property</title>     </head>     <body>     <script language="JavaScript">     <!--     function checkButton(){         if(document.form1.button1.checked == true){             alert("Box1 is checked");         } else if(document.form1.button2.checked == true){             alert("Box 2 is checked");         }     }     -->     </script>     <form name="form1">     <input type="radio" name=button1>Box 1     <br>     <input type="radio" name=button2 CHECKED>Box 2     <br>     <INPUT type="button" value="Get Checked" onClick='checkButton()'>     </form>     </body>     </html>