Mega Code Archive

 
Categories / JavaScript DHTML / Form Control
 

Check a Radio Button

<html> <body> <form> <script>     function function1() {         document.all.myRadioButton1.checked = true;     }     function function2() {         document.all.myRadioButton2.checked = true;     }     function function3() {         document.all.myRadioButton3.checked = true;     }     function function4() {         document.all.myRadioButton4.checked = true;     } </script> <input id="myRadioButton1" type="radio" name="radiobutton" value="radiobutton">VISA <input id="myRadioButton2" type="radio" name="radiobutton" value="radiobutton">MASTERCARD <input id="myRadioButton3" type="radio" name="radiobutton" value="radiobutton">DISCOVER <input id="myRadioButton4" type="radio" name="radiobutton" value="radiobutton">AMERICAN EXPRESS <br> <input type="button" value="VISA checked" onClick="function1();"> <input type="button" value="MASTERCARD checked" onClick="function2();"> <input type="button" value="DISCOVER checked" onClick="function3();"> <input type="button" value="AMERICAN EXPRESS checked" onClick="function4();"> </form> </body> </html>