<input type="radio" name="address" value="0" />web
<input type="radio" name="address" value="1" />spa
<input type="radio" name="address" value="2" />.net
js中 : var addressID = $("input[name='address']:checked").val();orm
把radio的name屬性值設置成同樣的,就會變爲單選。blog
var radio = document.getElementsByName("DoorCt");
for (i=0; i<radio.length; i++) {
if (radio[i].checked) {
alert(radio[i].value)
}
} ip
http://blog.csdn.net/magi1201/article/details/44465557ci