Refactored setSelectOptions with jQuery code

This commit is contained in:
ninadsp
2010-06-07 02:41:46 +05:30
parent 96c0bf5511
commit 3553df0dc2

View File

@@ -1268,13 +1268,13 @@ function setCheckboxColumn(theCheckbox){
*/
function setSelectOptions(the_form, the_select, do_check)
{
var selectObject = document.forms[the_form].elements[the_select];
var selectCount = selectObject.length;
for (var i = 0; i < selectCount; i++) {
selectObject.options[i].selected = do_check;
} // end for
if( do_check ) {
$("form[name='"+ the_form +"']").find("select[name='"+the_select+"']").find("option").attr('selected', 'selected');
}
else {
$("form[name='"+ the_form +"']").find("select[name="+the_select+"]").find("option").removeAttr('selected');
}
return true;
} // end of the 'setSelectOptions()' function