tardebut Posted December 3, 2011 Share Posted December 3, 2011 Hi all, I need a pair of select boxes to behave like, 1- Just one of them can be checked at any time (like radiobuttoms)2- Both can be unchecked at will (like select boxes). The code bellow is what I have written but it is not working, <html><head><script>function reCheck(k){if(k<3){document.forms["myform"][k+3].checked = false; } else{document.forms["myform"][k-3].checked = false;}}</script></head><body><form name = "myform" action="dothis.php" method="post"><table id="MyTable"><?phpfor($i=0;$i<=2;$i++){$j = $i + 3;echo "<tr>";echo "<td>";echo "<input type=\"checkbox\" name=\"".$i."\" onclick = \"reCheck(".$i.")\" />".$i;echo "</td>";echo "<td>";echo "<input type=\"checkbox\" name=\"".$j."\" onclick = \"reCheck(".$j.")\" />".$j;echo "</td>";echo "</tr>";}?></table></form></body></html> As you can see, in this case there are three rows with a pair of select boxes each, and I need that each pair have the behaviour described above. Looking forward to hear from you, tardebut Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.