Jump to content

checkbox to check/uncheck all


TeddyKiller

Recommended Posts

function SetChecked(val,chkName)
{
    dml = document.forms['myForm'];
    len = dml.elements.length;

    for(i = 0; i < len; i++)
    {
        if (dml.elements[i].name == chkName)
        {
            dml.elements[i].checked = val;
        }
    }
}

 

Thats my javascript and my check and checkall is..

 

<a href="javascript:SetChecked(1,'checkItem[]')">Check All</a> <a href="javascript:SetChecked(0,'checkItem[]')">Uncheck All</a>

 

Though how do I get it to work with a check box.

 

<input type="checkbox" name="uccall" />

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/206954-checkbox-to-checkuncheck-all/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.