[Programming] Javascript : Checkbox

Sorry guys.
This entry might be too techie, as for some people it could damage their brain.
Ahahhaha! Am exaggerating it!

For adik kuniya.
Please prepare a jar of kuih tart as for my professional service.

<title>Checkbox list</title>
<script language="javascript">
function checkBoxList(formObj) {
var returnVal = false;
var counter = 0;
var fieldObj = null;
var fieldObjValue = '';
var checkedValue = '';
var msgPrompt = '';
var totalRec = formObj.total.value;
//alert('total record : ' + totalRec);

for(a=0; a<totalRec; a++) {
fieldObj = eval("formObj.del" + a);
if(fieldObj.checked) {
fieldObjValue = fieldObj.value;
if(checkedValue != '') checkedValue += ', ';
checkedValue += fieldObjValue;

if(counter > 0) {
msgPrompt = 'Total checkbox has been checked is : ' + counter;
msgPrompt += "\nThe value are/is : " + checkedValue;
//returnVal = true;
} else {
msgPrompt = 'No checkbox is checked';

return returnVal;

<form name="checkboxForm" method="post" action="">
<table align="center" width="50%" cellpadding="0" cellspacing="0" border="0">
<tr><td>Check box 1</td><td align=center><input type="checkbox" name="del[0]" id="del0" value="1"></td>
<tr><td>Check box 2</td><td align=center><input type="checkbox" name="del[1]" id="del1" value="2"></td></tr>
<tr><td>Check box 3</td><td align=center><input type="checkbox" name="del[2]" id="del2" value="3"></td></tr>
<tr><td>Check box 4</td><td align=center><input type="checkbox" name="del[3]" id="del3" value="4"></td></tr>
<tr><td>Check box 5</td><td align=center><input type="checkbox" name="del[4]" id="del4" value="5"></td></tr>
<tr><td colspan=center>
<input type="hidden" name="total" value="5">
<input type="submit" name="submit" value="submit" onClick="return checkBoxList(document.checkboxForm);">
<input type="reset" name="reset" value="reset">



  1. ahaha?? gue nggak pande bikin kueh atu!! gue hanye gheti makannya saja..


My Instagram