Javascript checkboxes
<p>I want to know the number of checboxes checked in javascript. If only one checkbox is checked then it should show an alert message, otherwise it should do the processing. I tried <code>if(names[i].checked&gt;2)</code> but it is not working.. Please help.</p>

<pre><code>function insert_slide(ed, height, width)

{ var img=new Array();

var names=document.getElementsByName('image_id');


for(i=0;i&lt;names.length;i++)
{
if(names[i].checked)
{
    img[i] = "&lt;IMG SRC='" + names[i].value + "'";






    if(height != '') {
        img[i] += " height='" + height + "'";
    }
    if(width != '') {
        img[i] += " width='" + width + "'"; 
    }
    img[i] += " style='margin: 5px;' &gt;";

    editor.nicCommand("insertHTML", img[i]);
}}
    hide_lightwindow();
}
</code></pre>
