new function to gather selected checkboxes

This commit is contained in:
Cornelius Weiß 2006-10-07 15:02:17 +00:00
parent 3b589d43cf
commit 79716a8048

View File

@ -224,3 +224,17 @@ function enable_button(id) {
document.getElementById(id).style.color = '';
}
// returns selected checkboxes from given 'var form' which REAL names end with 'var suffix'
function get_selected(form,suffix) {
selected = '';
el = form.getElementsByTagName('input');
for (var i = 0; i < el.length; i++) {
if(el[i].name.substr(el[i].name.length-suffix.length,el[i].name.length) == suffix && el[i].checked) {
if(selected.length > 0) {
selected += ',';
}
selected += el[i].value;
}
}
return selected;
}