i have a select box that gets populated from a table in the database. it contains names of the customers. i want a check box or a radio button which when checked selects all the items (names) in the select box. thanks in advance
Here is a javascript function that will do just that. function SetAllCheckBoxes(FormName, FieldName, CheckValue) { if(!document.forms[FormName]) return; var objCheckBoxes = document.forms[FormName].elements[FieldName]; if(!objCheckBoxes) return; var countCheckBoxes = objCheckBoxes.length; if(!countCheckBoxes) objCheckBoxes.checked = CheckValue; else // set the check value for all check boxes for(var i = 0; i < countCheckBoxes; i++) Code (markup):
thanks for your reply dgxshiny but that cose is to select all check boxes but what i want is to select items in select box. please clarify me if i am wrong.