Tru out this.
Code:
<html>
<script language="javascript">
function check()
{
no = new Array();
i=0;
if(document.getElementById("1").checked)
no[i++]=1;
if(document.getElementById("2").checked)
no[i++]=2;
if(document.getElementById("3").checked)
no[i++]=3;
if(document.getElementById("4").checked)
no[i++]=4;
if(document.getElementById("5").checked)
no[i++]=5;
if(document.getElementById("6").checked)
no[i++]=6;
if(document.getElementById("7").checked)
no[i++]=7;
if(document.getElementById("8").checked)
no[i++]=8;
if(document.getElementById("9").checked)
no[i++]=9;
if(document.getElementById("10").checked)
no[i++]=10;
str = "";
for(j=0;j<i;j++)
str = str + no[j] + ";";
alert(str);
}
</script>
<body>
<input type="checkbox" name="alotofcheckboxes" value="1" id="1"/><br>
<input type="checkbox" name="alotofcheckboxes" value="2" id="2" /><br>
<input type="checkbox" name="alotofcheckboxes" value="3" id="3" /><br>
<input type="checkbox" name="alotofcheckboxes" value="4" id="4" /><br>
<input type="checkbox" name="alotofcheckboxes" value="5" id="5" /><br>
<input type="checkbox" name="alotofcheckboxes" value="6" id="6" /><br>
<input type="checkbox" name="alotofcheckboxes" value="7" id="7" /><br>
<input type="checkbox" name="alotofcheckboxes" value="8" id="8" /><br>
<input type="checkbox" name="alotofcheckboxes" value="9" id="9" /><br>
<input type="checkbox" name="alotofcheckboxes" value="10" id="10" /><br>
<br><br>
<input type="button" value="Create array" onclick=check() />
</body>
</html>
Bookmarks