tardebut 0 Posted December 3, 2011 Report 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 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.