<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title></title>
    <script language="javascript" type="text/javascript">
        /*function categoryOnClick() {
            var selectedRows = document.searchForm.elements['categorySelect[]'];
            alert(selectedRows.length);
        }*/
    
	
	 function categoryOnClick() {

            var rows = document.getElementsByName('categorySelect[]');
            var selectedRows = [];
            for (var i = 0, l = rows.length; i < l; i++) {
                if (rows[i].checked) {
                    selectedRows.push(rows[i]);
                }
            }
            
            alert(selectedRows.length);

        }
	
		 function toto() {

            var rows = document.getElementsByName('categorySelect[]');
			
			
            var selectedRows = [];
            for (var i = 0, l = rows.length; i < l; i++)
			{
                /*if (rows[i].checked) {
                    selectedRows.push(rows[i]);
                }*/
				 selectedRows.push(rows[i]);
			//	 alert(rows[i]);
            }
            
			//alert(selectedRows.join('\n'));
            alert(selectedRows.value);

        }
	
	//total +=document.form1.scripts[i].value + "\n"
	
	</script>
	
	
	
</head>
<body>
        <input type="checkbox" name="categorySelect[]" id="1" />
        <input type="checkbox" name="categorySelect[]" id="2" />
		
		<input type="checkbox" name="vehicle[]" value="Bike"/>
		<input type="checkbox" name="vehicle[]" value="Car"/>
		<input type="checkbox" name="vehicle[]" value="Airplane"/>
		
		<input type="submit" value="Envoyer" onclick="toto();" /> 
</body>
</html>