Jump to content

Strange Html Radio Button: Only One Feature Disabled


tinfanide

Recommended Posts

<html><head><script>function parseXML(method,xml,async){if(window.XMLHttpRequest){  xmlhttp = new XMLHttpRequest();  xmlhttp.open(method,xml,async);  xmlhttp.send();  }else {  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") ;  xmlhttp.async=async;  xmlhttp.load(xml);  }xmlDoc = xmlhttp.responseXML;}parseXML("GET","multipleChoices.xml",false);function test(){if(document.getElementById("c1").checked == true){  alert(1);  } else {   alert(2);   }}</script></head><body><form name="form"><fieldset>	 <input type="radio" id="c1" value="a" name="a" />a	    <input type="radio" id="c2" value="b" name="b" />b	 <input type="radio" id="c3" value="c" name="c" />c	 <input type="radio" id="c4" value="d" name="d" />d    </fieldset>    <input type="button" value="submit" onClick="test()" /></form></body></html>

Radio buttons should only be unique. Only one option is allowed to select. But in my case, more than one radio button are allowed to be clicked.Why? And how to fix it?

Link to comment
Share on other sites

All radio buttons, in the same category, should have the same name. Ex:colors:

()red()blue()green.

given the above radios, all the radios should have the same name, which means that they are under colors (the same category), and one should be selected and not all.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...